Need help setting up an API

Hi,

I’m having troubles setting up an API in a server action. This API sends an SMS message to a cell phone.
I managed to make it work using curl from a windows command prompt my but I can’t make it work using Wappler.

This is the curl command that successfully sends the message

A few seconds later, I get the SMS in <CELLPHONE_NUMBER>

I tried to reproduce that result using Wappler but with no success.

I created an API in a server action that is fired from a page. Its definition is below:

To remove possible variables, I hardcoded in the URL the values of the vendor-provided key and the cellphone number, to resemble exactly what I’m sending using curl.

Unfortunately, it does not work.
In my page, I’m capturing the server connect’s lastError.status, lastError.message, and lastError.response:

500 | Internal Server Error | SenderError occurred. Please try again and contact support if the problem persists.

I read all the material I could find about the APIs but the solution still eludes me.

Am I doing something wrong?

Many thanks!

Change data type from auto to JSON.

I think the format in the JSON field should be something like this:

{
“MessageBody”: “Hi there”
}

It worked!!
Many many many thanks!!

1 Like