# How to use web api with post + parameters and with form

**URL:** https://community.thunkable.com/t/how-to-use-web-api-with-post-parameters-and-with-form/1884526
**Category:** Web API's
**Created:** [May 19, 2022, 10:15am UTC](https://community.thunkable.com/t/how-to-use-web-api-with-post-parameters-and-with-form/1884526 "2022-05-19T10:15:26Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![vicentepaulodecamarg](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/vicentepaulodecamarg/32/49067_2.png) [@vicentepaulodecamarg](https://community.thunkable.com/u/vicentepaulodecamarg)
#### Post date: [May 19, 2022, 10:15am UTC](https://community.thunkable.com/t/how-to-use-web-api-with-post-parameters-and-with-form/1884526/1 "2022-05-19T10:15:26Z")

</div>

I need to send a post request with two parameters using application/x-www-form-urlencoded (with form basic). The response is an authorization token. How should I create this web api block? I’m new with thunkable.  
Grateful

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [May 19, 2022, 11:05am UTC](https://community.thunkable.com/t/how-to-use-web-api-with-post-parameters-and-with-form/1884526/2 "2022-05-19T11:05:26Z")

</div>

Welcome to Thunkable.

Use the body block of the `Web API` for the parameters as if you are writing these parameters in the URL in the browser.

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [May 19, 2022, 2:59pm UTC](https://community.thunkable.com/t/how-to-use-web-api-with-post-parameters-and-with-form/1884526/3 "2022-05-19T14:59:22Z")

</div>

There are some examples of this here:

> [@How do I convert cURL syntax to thunkable?](https://community.thunkable.com/t/how-do-i-convert-curl-syntax-to-thunkable/1872067/9):
>
> i think the api-key has no limit - i’ve used it in and out of postman several times for 2 days and i get 200 return codes (see below) for the same reason i think the same api-key should also work in thunkable. but i can’t seem to make thunkable to do this. i’ve tried your suggestion, and other settings. can you (@muneer or anyone else) try to make my project (see below) work? thanks. here’s my postman screenshots and the link to the output: https://api.deepai.org/job-…

---

<div class="post-metadata">

### Author: ![vicentepaulodecamarg](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/vicentepaulodecamarg/32/49067_2.png) [@vicentepaulodecamarg](https://community.thunkable.com/u/vicentepaulodecamarg)
#### Post date: [May 19, 2022, 4:37pm UTC](https://community.thunkable.com/t/how-to-use-web-api-with-post-parameters-and-with-form/1884526/4 "2022-05-19T16:37:26Z")

</div>

munner,  
How should I specify the content-type? Do I use object or a string in headers?  
I adjusted as you said, but it keeps returning error. See the image of the current code.

 ![erroWebApi01](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/8/784fde3b675b33bdaf0f97ce98265b6545660ca4.png)

Thanks for the help.

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [May 19, 2022, 5:48pm UTC](https://community.thunkable.com/t/how-to-use-web-api-with-post-parameters-and-with-form/1884526/5 "2022-05-19T17:48:52Z")

</div>

Please see the link to the topic I posted above. It shows a screenshot with the Content-Type configuration.

It’s going to be really hard to troubleshoot any errors you’re getting without:

1. Knowing what the exact error message is
2. Either having a link to the documentation or knowing the API url

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [May 19, 2022, 6:03pm UTC](https://community.thunkable.com/t/how-to-use-web-api-with-post-parameters-and-with-form/1884526/6 "2022-05-19T18:03:56Z")

</div>

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

It would be very helpful to know the error so if you do this condition to show what kind of error you are getting.

In your case, you are displaying the header whether there is an error or not.

---

<div class="post-metadata">

### Author: ![vicentepaulodecamarg](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/vicentepaulodecamarg/32/49067_2.png) [@vicentepaulodecamarg](https://community.thunkable.com/u/vicentepaulodecamarg)
#### Post date: [May 20, 2022, 11:02am UTC](https://community.thunkable.com/t/how-to-use-web-api-with-post-parameters-and-with-form/1884526/7 "2022-05-20T11:02:50Z")

</div>

munner, I still haven’t gotten the expected result. For better understanding, look at this request image by bummerang. The API requests a post using form basic with the two parameters indicated, and the response must be sent with sent request. In this case I need to get the authorization content

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/8/d822a3303988f8d1d40e184968b74c17232e02b8.png).  
Thanks.

---

<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: [May 20, 2022, 12:06pm UTC](https://community.thunkable.com/t/how-to-use-web-api-with-post-parameters-and-with-form/1884526/8 "2022-05-20T12:06:43Z")

</div>

Set another header called Authorization and feed it `Basic <ya.accessTokenValueGoesHere>`

You should print your error messages to a label. It will be helpful to know what error is occurring when you make the call

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [May 20, 2022, 12:30pm UTC](https://community.thunkable.com/t/how-to-use-web-api-with-post-parameters-and-with-form/1884526/9 "2022-05-20T12:30:48Z")

</div>

I made this quick setup

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

I got this response

 ![Screenshot_2022-05-20-15-48-34-73_2bbfbfee96a5dfce998f962ebb8b5da3](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/7/d7b06cb04093ffd5a84fc0928e5b4e39f0e26375.jpeg)

---

<div class="post-metadata">

### Author: ![vicentepaulodecamarg](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/vicentepaulodecamarg/32/49067_2.png) [@vicentepaulodecamarg](https://community.thunkable.com/u/vicentepaulodecamarg)
#### Post date: [May 20, 2022, 5:24pm UTC](https://community.thunkable.com/t/how-to-use-web-api-with-post-parameters-and-with-form/1884526/10 "2022-05-20T17:24:53Z")

</div>

muneer,  
You are using the authorization field. This field should not be used in the post request, as per API documentation. This post gives me this authorization back, but I can’t receive the content of this authorization. How should I code the post so that it receives this authorization by just sending the two parameters and the header with the content-type? I’m not having success

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [May 21, 2022, 7:09am UTC](https://community.thunkable.com/t/how-to-use-web-api-with-post-parameters-and-with-form/1884526/11 "2022-05-21T07:09:17Z")

</div>

You need to make a code similar to this  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/7/87c065c93b32618c716162cc138bc135403c79df.png)

However, you need to check with the documentation of this API to supply the correct parameters in the `body` block.

Alternatively,  
You can use my **Encrypt / Decrypt** demo project to convert the entries to the required coded string for **authorization**

[https://x.thunkable.com/projectPage/60ba3f2079d6dc001150abe7](https://x.thunkable.com/projectPage/60ba3f2079d6dc001150abe7)

---

<div class="post-metadata">

### Author: ![vicentepaulodecamarg](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/vicentepaulodecamarg/32/49067_2.png) [@vicentepaulodecamarg](https://community.thunkable.com/u/vicentepaulodecamarg)
#### Post date: [May 21, 2022, 8:42am UTC](https://community.thunkable.com/t/how-to-use-web-api-with-post-parameters-and-with-form/1884526/12 "2022-05-21T08:42:22Z")

</div>

munner, thanks for the valuable guidance.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)
#### Post date: [August 19, 2022, 8:43am UTC](https://community.thunkable.com/t/how-to-use-web-api-with-post-parameters-and-with-form/1884526/13 "2022-08-19T08:43:18Z")

</div>

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