Get SMS Details

Description

Returns detailed information about a particular SMS message sent by Control Center to a device or sent by a device to Control Center. You cannot get information about messages exchanged between a device and a non-Control Center SMS client.

Users with Essential accounts must purchase the Essential SMS Service package in order to use this API.

Resource URL

GET rws/api/v{apiVersion}/smsMessages/{smsMsgId}

Request Parameters

Request Parameters and Descriptions
Parameter Description
apiVersion

The version number for this API. The current version for all functions is 1.

smsMsgId A unique identifier for the SMS message you want to retrieve.
messageEncoding (Optional) The type of message encoding used. Valid values are: LITERAL (default) or BASE64.

Response Parameters

Return Values and Descriptions
Return Value Description
smsMsgId A unique identifier for the SMS message.
status

The message delivery status. Valid values depend on the message type.

  • Mobile-Originated (MO): Received
  • Mobile-Terminated (MT): Cancelled, CancelFailed, CancelPending, Delivered, Pending, Failed, Unknown.
messageText The content of the SMS message.
senderLogin

Identifies the message sender. For mobile-originated messages, this value is Mobile Device. For mobile-terminated messages, the value is the Control Center user name.

sentTo

Identifies the recipient of the message. If the recipient is Control Center, the value is Server. Otherwise, the recipient device’s MSISDN, the equivalent of a phone number, appears.

sentFrom

Identifies the device or computer that sent the message. If the sender is Control Center, the value is Server. Otherwise, the sending device’s MSISDN, the equivalent of a phone number, appears.

msgType Message Type indicates whether the message was sent by the device (MO, mobile-originated) or received by the device (MT, mobile-terminated).
dateSent The date and time (including the time zone) when the message was sent. See Date Formats.
dateReceived The date and time (including the time zone) when Control Center received the message. See Date Formats.
dateModified The date and time (including the time zone) when the delivery status changed. See Date Formats.

Request Example

Make sure to use your own user credentials. See Authentication for information about creating an authorization header.

json
Copycurl -X GET --header "Accept: application/json" --header "Authorization: Basic <YOUR-ENCRYPTED-CREDENTIALS>" "https://rws-jpotest.jasper.com/rws/api/v1/smsMessages/106184"

Response Example

json
Copy{
	"smsMsgId": 106184,
	"status": "Pending",
	"messageText": "Hello world",
	"senderLogin": "dpTrialUser2",
	"iccid": "8988216716970004975",
	"sentTo": "882351697004975",
	"sentFrom": "Server",
	"msgType": "MT",
	"dateSent": "2016-07-06 16:05:16.280-0700",
	"dateModified": "2016-07-06 16:05:16.522-0700"
}

Code Samples

Make sure to use the Control Center sandbox URL and your own user credentials.

python
javascript
ruby
Copyimport requests 
import json 
import base64 
import pprint 

cobrandURL=input("Cobrand URL: ")						
url = 'https://'+input("Cobrand URL: ")+'/rws/api/v1/smsMessages/'+input("SMS Message ID: ") 
myResponse = requests.get(url,auth=(input("username: "),input("api_key: ")))
# For successful API call, response code will be 200 (OK)
if(myResponse.ok):
    # Loading the response data into a dict variable
    # json.loads takes in only binary or string variables so using content to fetch binary content
    # Loads (Load String) takes a Json file and converts into python data structure (dict or list, depending on JSON)
    jData = json.loads(myResponse.content)
    pp=pprint.PrettyPrinter(indent=4) 
    pp.pprint(jData) 
else:
    # If response code is not ok (200), print the resulting http error code with description
    print("Failure")
    myResponse.raise_for_status()
Copyvar request = require('request');
var body = [];
request.get('https://<your-base-URL>/rws/api/v1/smsMessages/23178931802').auth('username', 'password', false)
    .on('error', function(error){
        console.log('Error:', error);
    })
    .on('response', function(response) {
        console.log(response.statusCode); // return statusCode
        console.log(response.headers['content-type']); // return contentType
    })
    .on('data',function(chunk){
        body.push(chunk);
    })
    .on('end',function(){
        body = Buffer.concat(body).toString();
        console.log(body);
    });
Copy#!/usr/bin/ruby -w
require 'rest-client'
require 'json'
  
url = 'https://rws-jpotest.jasper.com/rws/api/v1/smsMessages/25830319302'
response = RestClient::Request.execute(
 method: :get,
 url: url,
 user: 'username',
 password: 'password',
 :headers => {:accept => :json}
)
puts JSON.pretty_generate(JSON.parse(response))

Errors

Error Codes, HTTP Codes, and Descriptions
Error Code HTTP Code Error Message
10000001 401

Invalid credentials.

Description: Control Center uses this error message when the API credentials are invalid or when the IP address is not within the allowed range.

10000017 400 Invalid messageEncoding.
10000024 400 Invalid apiVersion.
20000002 404 Resource not found - Invalid smsMsgId.
30000001 500 Unknown server error.