POST Bodies
URL Encoded
When sending URL- encoded data, set your HTTP Content-Type header to application/x-www-form-urlencoded and present your key/value pairs according to RFC-3986.
For example, aPOSTrequest to create a section might look something like this:
POST /api/blocks/<SECTION_ID>/sections HTTP/1.1
Accept: application/json
X-MBurger-Token: <TOKEN>
X-MBurger-Version: <VERSION>
Content-Type: application/x-www-form-urlencoded; charset=utf-8
elements[en][title]=Awesome+Title&elements[en][content]=Awesome+Content&elements[en][title]=Titolo&elements[en][content]=ContenutoIn this example, you are creating one section with two elements title and content both in English and Italian.
As you can see, every key of an element must be in the form of  elements[LOCALE][ELEMENT_NAME]
Multipart Encoded
If you have to send files you must use multipart/form-data. An example:
POST /api/blocks/<SECTION_ID>/sections HTTP/1.1
Accept: application/json
X-MBurger-Token: <TOKEN>
X-MBurger-Version: <VERSION>
Content-Type: multipart/form-data; charset=utf-8; boundary=YOUR_BOUNDARY
--YOUR_BOUNDARY
Content-Disposition: form-data; name="elements[en][title]"
Title
--YOUR_BOUNDARY
Content-Disposition: form-data; name="elements[en][image][0]"; filename="image1.jpg"
Content-Type: image/jpeg
<IMAGE_DATA>
--YOUR_BOUNDARY
Content-Disposition: form-data; name="elements[en][image][1]"; filename="image2.jpg"
Content-Type: image/jpeg
<IMAGE_DATA>
--YOUR_BOUNDARY--In this example, you are creating one section with two elements title and image only in English.
As you can see, every key of a media element (image, audio, video, document, file) must be in the form of elements[LOCALE][ELEMENT_NAME][INDEX].
Last updated
Was this helpful?