Http request with data in codeless block

Hi, Im trying to setup a http POST and send some data in the body how can i do this please see screenshot of my block so far.

Hello, @Mohamed_Swaghi,

here’s an example of how to POST a new object to the Person table:

The Codeless HTTPS block is similar to the request you send via curl. E.g. the curl request for the block I’ve provided is

curl 'https://mydomain.backendless.app/api/data/Person' \
-X 'POST' \
-H 'Content-Type: application/json' \
--data-binary '{"name":"Bob","age":35}'

Hope it would help.

Regards,
Olha

Hi Olha,
Thank you verry much for your help. What about nested values? because the api requires me to send it like this (im getting error see screenshot):
{
amount: {
currency: ‘EUR’,
value: ‘10.00’,
}
}

I tried using amount[currency] but with no luck.
Hope you can help me.
By the way this is link to the documents of the api:
https://docs.mollie.com/reference/v2/payments-api/create-payment

Hi Mohamed,

You need to declare the “amount” property (just like you were doing it for “amount[value]”) and attach another Create Object block to it with the currency and value properties.

Regards,
Mark

Hi Mark,
Thank you for your support!
I did what you told me but still getting the “amount required” error please see the screenshot.

Im sorry Mark, i think i did figure it out i didnt deploy. :sweat_smile:

Try doing it in UI Builder (for example in the On Page Enter event). This way you can see what the payload looks like. I am not familiar with the API you are using and cannot say what went wrong. The codeless logic you put in there will generate the body as you described, however, aparently something else is missing. Seeing the payload (which you will see in the browser’s Network tab in the devtools) will make it easier for you to diagnose the problem.

Regards,
Mark