API Needs a json body with no Key only a Value

Hey all,

The API connection I am trying to utilise requires a Parameter content type of application/json where the body needs to be passed as a json with no Key just the value.

For example this is the cURL for a request I am trying to make:

curl -X 'POST' \ 'https://cloudposapi.citruslime.com/api/ItemDetail/ItemLookupCode' \ -H 'accept: application/json' \ -H 'Authorization: ---sanitized---' \ -H 'Content-Type: application/json' \ -d '"001"'

How would I set this up as a query? Only way I can think of is the following:

But if I try run the query it does not attach the Body (I presume due to it missing a key):

"body": "{}",

I tried using raw, and it does not support it. Only JSON. Any help would be appriciated!

What doesn't work with raw? Do you get an error? I built a REST request and sent it to my ngrok instance and it looks like it works.

Hey Matth,

Apologies for that I don't think I explained it as well as I could. Whenever I make a post request with a JSON body like in the attached screenshot below, I recieve an error saying I did not post the Item Lookup Code (001 in this example). From what I can see Retool does not like to send a JSON body with no key before a value. The only way I could think of sending one would be using a Raw body, but this API does not accept raw.

Below I attached an image of what my query setup is like & what response I get:

Body JSON:



Body Raw:



I managed to test the API and get it working on Postman with x-www-form-urlencoded but trying the same on Retool does not work:


Postman test body

With raw and json you need to explicitly set the "Content-Type" header to application/json

1 Like

Hi CreComms,

Could you possible let me know how you got ReTool to pull datafrom CitrusLimes API as at the moment I cannot get it to pull data.

Regards
Neil

Hey @neilspinney ,

Apologies for the lack of reply. If you would like I can send a brief explanation is there an email I could send this to?