REST API "Status 500" Error

brycefraser
Giga Contributor

Hey everyone,

I am trying to implement the Telstra SMS API within ServiceNow, this API allows us to SMS to Australian numbers via REST messages.


I have been able to make the API work fine through manual coding (e.g. constructing the REST message in Powershell and running it, for example), however everytime I try to add it into ServiceNow, I recieve a 'Status 500 Internal Error' message.

The API is fairly simple (T.DEV | SMS Getting started). OAuth is set up and retrieving the token fine, however when "Send SMS" is utilised it returns that error.

This is the format from the API:

# * Recipient number should be in the format of "04xxxxxxxx" where x is a digit

# * Authorization header value should be in the format of "Bearer xxx" where xxx is access token returned

#     from a previous GET https://api.telstra.com/v1/oauth/token request.

RECIPIENT_NUMBER="your number"

TOKEN="<access_token>"

curl -H "Content-Type: application/json" \

-H "Authorization: Bearer $TOKEN" \

-d "{\"to\":\"$RECIPIENT_NUMBER\", \"body\":\"Hello!\"}" \

"https://api.telstra.com/v1/sms/messages"

A successfully sent message looks like this:

message sent.JPG

What i've currently got set up is this.

Here is the REST Message:

rest message.JPG

And here is my post method:

find_real_file.png

I'm honestly not sure how to proceed with this or what I am missing.

Telstra advises that the status 500 error is:

500 Internal ServerAn internal error occurred when processing the request

It does say internal error occurred, however I'm definitely sure it is something to do with how i've set the messages up, as I do not get an error when running a rest message through Powershell.

Does anyone have any ideas of where I can go from here?

Is there a way I can view the actual rest message that is being sent out when I hit "test"?

Thanks for your help!

7 REPLIES 7

pchaudhuri
Kilo Explorer

Hi,



You can debug your Rest API by using the rest api explorer


Hi there,



Thanks for your reply, it looks as though the API Explorer is used to test out internal ServiceNow APIs, whereas I'm looking to send a specific REST POST message to an external API.


Oh Im sorry i thought you wrotethe rest web service. I did not understand that you were consuming it


No worries, thanks though!