REST API "Status 500" Error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2016 03:09 AM
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:
What i've currently got set up is this.
Here is the REST Message:
And here is my post method:
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 Server | An 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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2016 04:01 AM
Hi,
You can debug your Rest API by using the rest api explorer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2016 04:08 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2016 04:12 AM
Oh Im sorry i thought you wrotethe rest web service. I did not understand that you were consuming it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2016 04:14 AM
No worries, thanks though!