HTTP POST format problem

I'm developing a personal ecommerce and i need to develop a procedure to get payment using my bank account.
To do so I should make a POST request to a server.
Instructions to make this request are:
HEADERS: Content-Type``application/json
Authorization apikey {merchant Api Key}
"buyerEmail": "",
"paymentChannel": {
"channelType": [

How should I format this in AI?
For headers I've made a list of lists and seems correct But which method and what type of formatting should I use? I'm using PostText at the moment and made some tests but I always get a 1103 Error
Here Is my code
POST format !
thank you!

Looks OK.....

Perhaps you need to build with text join blocks rather than list blocks


Also, have you tried GET (possibly PUT ?), the web component can sometimes work in mysterious ways....

To avoid every problems, I've tried inserting directly the complete string as text but i get always the same error.
I've tried even with thunkable X and it works with it using the same string, but I'd prefer to develop my software with AI.
But the POST method is different in thunkable, I can set the "body" property of POST like I do with Headers.
In AI I can only set the text of POSTText.
It seems to me Like the POSTText add a " at the beginning and at the end of the string or something similar.
That's why I was using list, trying to bypass the error.
Maybe there is a middle step I have to insert between the string and the POSTText
The only method accepted is POST I use it even with another software and it works.

Try with the buildRequestData block ?

any link to the API documentation?

to send that as text should work (theoretically)...
you might want to provide another screenshot including Do it result of the text you are posting...
how to use Do it see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
are you using a device or an emulator for your tests?


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

I would recommend using the dictionary blocks. When you pass the dictionary to PostText, it should serialize the object to JSON automatically [1]. If you continue seeing errors, could you let us know what the exact error message is?

Example (draggable):

[1] Actually, this is only true if the ShowListsAsJson property of Screen1 is true. It's safer to use the Web component's JsonObjectEncode method as I've done above, which does the right thing irrespective of the ShowListsAsJson property.


thanks to ewpatton for the formatting method. This is what I was looking for.
But it didn't solve my problem.
A little not by Taifun solved my problem :slight_smile:

I was Using the emulator so I checked and error 1103 seems to be a connection error.
So Maybe the emulator can't connect to internet (I don't' know if configuring it make it possible)
However, using my device with AICompanion solved. Now I am able to POST the message and receive my answer.
Thank you all!

1 Like

Which method to POST did you use in the end ?

POSTText with dictionary like suggested by ewpatton

I always used the JOIN to serialize JSON format. Good to know the dictionary blocks do it automatically.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.