# Getting Error while Sending API request in Thunkable

**URL:** <https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300>\
**Category:** Web API's\
**Tags:** newfeatures, webapi, stripe, error\
**Created:** [October 6, 2023, 1:39pm UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300 "2023-10-06T13:39:14Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![pacecode](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/pacecode/32/209017_2.png) [@pacecode](https://community.thunkable.com/u/pacecode)\
**Post date:** [October 6, 2023, 1:39pm UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/1 "2023-10-06T13:39:14Z")

</div>

**Hi There!**

I’m **Getting Error** while **Sending an API Reques** t even after **Sending same Request in Postman** in Which **I got Correct Response**  
**Please Help**

_Postman Request:_

 ![erta](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/0/70e5d2661186abc7a8da0693bcb79cd9cf5289dc.png)  
 ![dfgada](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/e/ae2408f57bc412c16b92e03525b7cc0f2145f69f.png)  
 ![afcs](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/b/6bb962cf1cbda4f9dc9aac10cda2e1e7feb90663.png)  
_Blocks:_  
 ![sdfASDF](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/0/c02f6fbf010f3d11081dab121966844d4cd7960a.png)  
_Error Response:_  
 ![gsdfgAf](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/0/b0f51cedb3bcac9318d912e9c83e043d0ac60615.png)

Thanks, whoocoder

---

<div class="post-metadata">

**Author:** ![steve\_synopsis](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@steve\_synopsis](https://community.thunkable.com/u/steve_synopsis)\
**Post date:** [October 6, 2023, 3:14pm UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/2 "2023-10-06T15:14:45Z")

</div>

Try removing the “generate JSON from object” from the Web\_API Body block.

---

<div class="post-metadata">

**Author:** ![pacecode](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/pacecode/32/209017_2.png) [@pacecode](https://community.thunkable.com/u/pacecode)\
**Post date:** [October 7, 2023, 12:42am UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/3 "2023-10-07T00:42:23Z")

</div>

Hi Steve!

I removed generate JSON block from Body o Web API but No Response was Being Shown.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/f/4f08edad179f0e7a9795d03100c10927d8f4953a.png)

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [October 7, 2023, 1:10pm UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/4 "2023-10-07T13:10:19Z")

</div>

Change your content type to application/json in the header

Format it as a proper Json object using list blocks with nested objects

---

<div class="post-metadata">

**Author:** ![pacecode](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/pacecode/32/209017_2.png) [@pacecode](https://community.thunkable.com/u/pacecode)\
**Post date:** [October 7, 2023, 1:44pm UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/5 "2023-10-07T13:44:40Z")

</div>

Can you Please send me the Bolcks so that I can Format the Body in List Format??

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [October 7, 2023, 1:51pm UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/6 "2023-10-07T13:51:37Z")

</div>

No 🤣

Please try first. At least show that you’re putting forth the effort to implement my feedback.

Post a new block example where you try to interpret what I meant.

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [October 7, 2023, 1:53pm UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/7 "2023-10-07T13:53:41Z")

</div>

Additionally, if you need that key to be private, you should do this call from a backend server. While you can do it from the client doesn’t make it a best or even safe practice.

Just something to think about

---

<div class="post-metadata">

**Author:** ![vishruth-ram](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vishruth-ram](https://community.thunkable.com/u/vishruth-ram)\
**Post date:** [October 8, 2023, 9:48am UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/8 "2023-10-08T09:48:12Z")

</div>

In Postman, **you are sending in the x-www-form-urlencoded method in thunkable you are sending in JSON format**. So just like @jared mentioned, set your `Content-Type` header to `application/json`. If it still doesn’t work then try adding these headers:

```auto
-H 'Accept-Encoding:gzip,deflate,br'
-h 'Accept:*/*'

```

---

<div class="post-metadata">

**Author:** ![pacecode](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/pacecode/32/209017_2.png) [@pacecode](https://community.thunkable.com/u/pacecode)\
**Post date:** [October 9, 2023, 6:30am UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/9 "2023-10-09T06:30:06Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/a/5a4e4ccffeaf5b19fe18764adb7a0f785a78362a.png)  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/b/1bfc764e85dadddd1575a4ee217c3fb0c4ee4cc8.png)  
Still error

---

<div class="post-metadata">

**Author:** ![vishruth-ram](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vishruth-ram](https://community.thunkable.com/u/vishruth-ram)\
**Post date:** [October 9, 2023, 2:22pm UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/10 "2023-10-09T14:22:43Z")

</div>

Try setting the `content-type` header to `x-www-form-urlencoded` again, Set `Accept` to `*/*`. If it still doesn’t work try removing some headers except `content-type`

---

<div class="post-metadata">

**Author:** ![pacecode](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/pacecode/32/209017_2.png) [@pacecode](https://community.thunkable.com/u/pacecode)\
**Post date:** [October 9, 2023, 3:34pm UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/11 "2023-10-09T15:34:55Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/a/9aa4cbd405eddd3ae7a3f3c6e0b59a081f463c8d.png)  
Still Error  
[  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/9/f9d0d15fcd32e86aaf754b0b9b47482261b7ae48.png)

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [October 9, 2023, 4:06pm UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/12 "2023-10-09T16:06:18Z")

</div>

> [@vishruth-ram](#):
>
> Try setting the `content-type` header to `x-www-form-urlencoded` again, Set `Accept` to `*/*`. If it still doesn’t work try removing some headers except `content-type`

pleaes show more of your blocks here

all of the api blocks, preferably

URL  
body  
query  
headers

---

<div class="post-metadata">

**Author:** ![pacecode](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/pacecode/32/209017_2.png) [@pacecode](https://community.thunkable.com/u/pacecode)\
**Post date:** [October 10, 2023, 9:27am UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/13 "2023-10-10T09:27:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [October 10, 2023, 11:08am UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/14 "2023-10-10T11:08:33Z")

</div>

Check this related solution from @muneer

> [@\[Solved\] Can you help me make a POST to Shelly using x-www-form-urlencoded calls?](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/28):
>
> The solution is something I have suggested earlier but now I tried it myself and can conform it works.

---

<div class="post-metadata">

**Author:** ![pacecode](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/pacecode/32/209017_2.png) [@pacecode](https://community.thunkable.com/u/pacecode)\
**Post date:** [October 10, 2023, 12:21pm UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/15 "2023-10-10T12:21:54Z")

</div>

I Used Xano Backend Server for API Request and Now It’s Working!

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [October 10, 2023, 1:17pm UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/16 "2023-10-10T13:17:31Z")

</div>

nice!

yeah, i always forget that the x-www-form-urlencoded needs to go in the body as text

Sorry but glad you got it working! you should share a screenshot or screen recording of the api call in xano for others to see the solution! 🙂

---

<div class="post-metadata">

**Author:** ![pacecode](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/pacecode/32/209017_2.png) [@pacecode](https://community.thunkable.com/u/pacecode)\
**Post date:** [October 30, 2023, 2:12am UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/17 "2023-10-30T02:12:38Z")

</div>

Hi Jared!

Sorry for the Late Reply 😅

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

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

Response:

```auto
{
request: {
url: https://api.stripe.com/v1/checkout/sessions,
method: POST,
headers: [
POST /v1/checkout/sessions HTTP/2,
Host: api.stripe.com,
accept-encoding: gzip, deflate,
authorization: Basic API KEY,
content-type: application/x-www-form-urlencoded,
accept: application/json,
content-length: 214],
params: {
success_url: https://thunkable.site/w/ ******************** ,
line_items[0][price]: price_ ***************************** ,
line_items[0][quantity]: 1,
mode: subscription,
discounts[][coupon: sq *********** }},
response: {
headers: [
HTTP/2 200,
server: nginx,
date: Mon, 30 Oct 2023 02:08:46 GMT,
content-type: application/json,
content-length: 2099,
access-control-allow-credentials: true,
access-control-allow-methods: GET,HEAD,PUT,PATCH,POST,DELETE,
access-control-allow-origin: *,
access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required,
access-control-max-age: 300,
... +10 more
],
result: {
id: cs_live_ **************************************************************************** ,
object: checkout.session,
after_expiration: null,
allow_promotion_codes: null,
amount_subtotal: ****** ,
amount_total: ***** ,
automatic_tax: {
enabled: false,
status: null},
billing_address_collection: null,
cancel_url: null,
client_reference_id: null,
client_secret: null,
consent: null,
consent_collection: null,
created: ******** ,
currency: inr,
currency_conversion: null,
custom_fields: [],
custom_text: {
shipping_address: null,
submit: null,
terms_of_service_acceptance: null},
customer: null,
customer_creation: always,
customer_details: null,
customer_email: null,
expires_at: & ****&**** ,
invoice: null,
invoice_creation: null,
livemode: true,
locale: null,
metadata: {},
mode: subscription,
payment_intent: null,
payment_link: null,
payment_method_collection: always,
payment_method_configuration_details: {
id: pmc_ ********************************************** ,
parent: null},
payment_method_options: null,
payment_method_types: [
card],
payment_status: unpaid,
phone_number_collection: {
enabled: false},
recovered_from: null,
setup_intent: null,
shipping_address_collection: null,
shipping_cost: null,
shipping_details: null,
shipping_options: [],
status: open,
submit_type: null,
subscription: null,
success_url: https://thunkable.site/w/ *************************************** ,
total_details: {
amount_discount: ******************* ,
amount_shipping: 0,
amount_tax: 0},
ui_mode: hosted,
url: https://checkout.stripe.com/c/pay/cs_live_ ********************************************************************************************************************************************************************************************************************************************************************************************************************************************************* },
status: 200}}

```

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [October 30, 2023, 12:23pm UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/18 "2023-10-30T12:23:28Z")

</div>

nice work!!

---

<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, 1:33pm UTC](https://community.thunkable.com/t/getting-error-while-sending-api-request-in-thunkable/2631300/19 "2024-11-08T13:33:22Z")

</div>


