POST Bodies

circle-info

When sending a HTTP POST, you may present your arguments as either standard POST parameters or use multipart/form-data if file are included.

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-3986arrow-up-right.

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]=Contenuto

In this example, you are creating one section with two elements title and content both in English and Italian.

circle-exclamation

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.

circle-exclamation
circle-info

Instead relation elements doesn't require a locale so the key must be in the form of ELEMENT_NAME[INDEX]

You can see an example in the Relationsarrow-up-right section 😉

Last updated