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

**URL:** <https://community.thunkable.com/t/api-post-doesnt-work-it-response-error-failed-to-fetch/603674>\
**Category:** Questions about Thunkable X\
**Tags:** beginner\
**Created:** [June 9, 2020, 4:01am UTC](https://community.thunkable.com/t/api-post-doesnt-work-it-response-error-failed-to-fetch/603674 "2020-06-09T04:01:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ubaldo.chantaca6](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ubaldo.chantaca6/32/72487_2.png) [@ubaldo.chantaca6](https://community.thunkable.com/u/ubaldo.chantaca6)\
**Post date:** [June 9, 2020, 4:01am UTC](https://community.thunkable.com/t/api-post-doesnt-work-it-response-error-failed-to-fetch/603674/1 "2020-06-09T04:01:43Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/2/a280c0927bac529772ed647ce3051d9638d4851a.png)

x thunkable BLOCKS

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/a/5ad86d78333945fc1895fe795ae71780e513e80e.png)

Live Test RESOULT

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/e/7ed9826e80505cb3d8c77396c91642d541ad731e.png)

Regards

---

<div class="post-metadata">

**Author:** ![gobassky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/gobassky/32/77019_2.png) [@gobassky](https://community.thunkable.com/u/gobassky)\
**Post date:** [June 9, 2020, 6:54am UTC](https://community.thunkable.com/t/api-post-doesnt-work-it-response-error-failed-to-fetch/603674/2 "2020-06-09T06:54:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [June 9, 2020, 7:00am UTC](https://community.thunkable.com/t/api-post-doesnt-work-it-response-error-failed-to-fetch/603674/3 "2020-06-09T07:00:45Z")

</div>

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

> [@How can I Reduce Image Size such as from 4 MB to 200 KB with Thunkable X](http://community.thunkable.com/t/how-can-i-reduce-image-size-such-as-from-4-mb-to-200-kb-with-thunkable-x/345180/9):
>
> Example upload from URL See [TinyPNG – API Reference](https://tinyjpg.com/developers/reference) for details.

---

<div class="post-metadata">

**Author:** ![ubaldo.chantaca6](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ubaldo.chantaca6/32/72487_2.png) [@ubaldo.chantaca6](https://community.thunkable.com/u/ubaldo.chantaca6)\
**Post date:** [June 9, 2020, 6:11pm UTC](https://community.thunkable.com/t/api-post-doesnt-work-it-response-error-failed-to-fetch/603674/4 "2020-06-09T18:11:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sleon003x2rq](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@sleon003x2rq](https://community.thunkable.com/u/sleon003x2rq)\
**Post date:** [June 9, 2020, 6:41pm UTC](https://community.thunkable.com/t/api-post-doesnt-work-it-response-error-failed-to-fetch/603674/5 "2020-06-09T18:41:26Z")

</div>

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

> [@Compose a POST request using web component](http://community.thunkable.com/t/compose-a-post-request-using-web-component/42897/12):
>
> How to pass Auth HTTP POST Request @jared you gave me an idea so i did some tests in 3 different apis i found online and this is what worked for me (my blocks should be self explanatory). Notes: don’t mind the naming conventions I was prototyping and too lazy to keep changing names. Authorization for most apis i came accross was always Basic and you will need to convert your user:passwd to base64 encoding. some apis use apikey:(password is blank) refer to api docs example lets say…

---

<div class="post-metadata">

**Author:** ![ubaldo.chantaca6](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ubaldo.chantaca6/32/72487_2.png) [@ubaldo.chantaca6](https://community.thunkable.com/u/ubaldo.chantaca6)\
**Post date:** [June 9, 2020, 10:46pm UTC](https://community.thunkable.com/t/api-post-doesnt-work-it-response-error-failed-to-fetch/603674/6 "2020-06-09T22:46:09Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/6/86c6b6197021121264115f40995ad8b6a935d1b7.png)

---

<div class="post-metadata">

**Author:** ![gobassky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/gobassky/32/77019_2.png) [@gobassky](https://community.thunkable.com/u/gobassky)\
**Post date:** [June 10, 2020, 4:07am UTC](https://community.thunkable.com/t/api-post-doesnt-work-it-response-error-failed-to-fetch/603674/7 "2020-06-10T04:07:14Z")

</div>

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. 😐

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.

---

<div class="post-metadata">

**Author:** ![ubaldo.chantaca6](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ubaldo.chantaca6/32/72487_2.png) [@ubaldo.chantaca6](https://community.thunkable.com/u/ubaldo.chantaca6)\
**Post date:** [June 10, 2020, 3:58pm UTC](https://community.thunkable.com/t/api-post-doesnt-work-it-response-error-failed-to-fetch/603674/8 "2020-06-10T15:58:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gobassky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/gobassky/32/77019_2.png) [@gobassky](https://community.thunkable.com/u/gobassky)\
**Post date:** [June 11, 2020, 3:24am UTC](https://community.thunkable.com/t/api-post-doesnt-work-it-response-error-failed-to-fetch/603674/9 "2020-06-11T03:24:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rodrigo.arellanoi](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rodrigo.arellanoi](https://community.thunkable.com/u/rodrigo.arellanoi)\
**Post date:** [June 11, 2020, 5:36pm UTC](https://community.thunkable.com/t/api-post-doesnt-work-it-response-error-failed-to-fetch/603674/10 "2020-06-11T17:36:21Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/1/81181a24b162dd8d42c9e0f8972ad8f50e308f55.png)

Test on computer:

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/9/998229fb873acde533d5b5ddafc60d7eb24672cc.png)

Test on phone:

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/3/f32e705ad72b65c056e99f2252bedca1fa5c9541.png)

Regards

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:27am UTC](https://community.thunkable.com/t/api-post-doesnt-work-it-response-error-failed-to-fetch/603674/11 "2024-11-08T11:27:09Z")

</div>


