Help Needed: POST Web API

Hi all,

So currently I am testing out an API for sms.to as I needed a workaround for mobile phone verification for an app. For context, in my country email verification just wont cut it due to phone/facebook authentication being a widespread norm (so without it, my app’s UX is instantly faulty). That puts firebase authentication out of the way, though I will still use it as the database.

The app is a mulit-vendor e-commerce app with payments and all that, but for some reason I am unable to put the correct body block so that the request is successfull so I keep getting “null” as my response.

I looked throught the other posts (1,2,3,4,5,6) but I still cant figure out how to put the body blocks, and I tested it with postman and it works so I presume my problem here must be the blocks. Below are the images of my blocks, api documentation, and succesfull postman test.

sms.to api docs (I did consider Twilio as it is mentioned a lot here, but unfortuantely it has no support for my country)

Postman POST Test (successful, I was trying to understand whether -d goes in the body or query parameters in thunkable blocks, looks like its a body thing)


Thunkable Project Blocks and Test (is my method to collect and display the response correct? as well as setting the body?)


To reiterate, my assumption is that the response is null here because there is a problem with my blocks. Any clues?

Edit: fixed spelling errors

Edit 2: The solution should be below this text. Muneer’s answer was 100% correct, I tested it again wihtout the generate JSON from object and just put the response, status, and error blocks in and it worked perfectly (no backslashes anymore). Good luck to all who face this problem, I hope this helps!

1 Like

You are not using any error handler so better show the full response of the API call and also show the error and status (all the green blocks of the API POST call.

Without these info you do not actually know what was the problem.

something similar to this {"success":false,"status":401,"message":"Invalid Token"}

1 Like

Hi Muneer,

Thanks for the suggestion, so you mean something like this?
image

1 Like

Do not use get object from JSON. You the green blocks directly to just display whatever comes from the API call.

Got it, switched it to generate JSON from object and that did the trick. Here is the response:

Blocks

Thunkable Preview

Thunkable Live Test

Thank you so much for the help Muneer!

1 Like

Status of 200 means success. Good luck to you for the rest of the app.

1 Like

Your API key and phone number are showing @kareem

@hdawc Whoops! Thanks for pointing that out, I have fixed it now.