API POST doesn't work it response Error: Failed to Fetch

Hello,

Ihave and API witch work perfectly in Insomnia API tester, but in x Thunkable doesnto work and it show me alway the error Failed to Fetch, I would apreciate your support/help.

Attached you could find the images about:

Testing in Insomnia

x thunkable BLOCKS

Live Test RESOULT

Regards

Hi, did you try using the “Query Parameters” instead of “body”?

If use basic authorization to log in to the service, see this example

I’m not sure about your recomendation, but, POST doesn’t accept the query parameters (in the HTTP link), POST only accept the parameters in the body. GET is the way to put the parameters in the HTTP link. If you have any sugestion I would apreciate if you will send me an example.

Hi ubaldo,
do you know what authentication method is expected?
also what do the headers look like in insomnia ?

i did some tests with api’s requiring different types of auth methods… in the post below you can see how I passed my parameters. maybe that will give you some ideas

Nothing is required header is null. When I did this test with Insomnia the server register the API’s call, but when I did it with Thunkable the server doesn’t register anything (nothing), I was thinking if Thunkable suport HTTP Links, becouse the API’s that I have been used and works are HTTPS.

Sorry mate, I missed out the POST part… Indeed I have been working a lot on GET (finance APIs mainly) and that clouded my mind somewhat. :neutral_face:

Btw, I have this unexplained issue with GET before. testing ok on other webpages, but not on thunkable. I inserted a short delay (say 0.1 secs) between the set URL or parameters bock and the GET block. Miraculously it worked… Can’t explain why. No harm trying on your POST call.

It’s a nice tip, delay souds logist, could you share me the instruction, and about the time of the delay, regards

Use the “wait” block, and put it just before the POST block. (maybe the previous block of setting the body content needs some time to complete, I’m not too sure). As for the time to wait, I usually put in 0.1 Secs. Need some trial and error to get consistent results and balance it against unnecessary delaying the process.

Hi, here is the correct way to form de json object. Sometimes the computer emulator doesn’t show the correct response, so try to test your app on your phone.

Test on computer:

image

Test on phone:

image

Regards