All Collections
API and Integration
REST API Sample Requests
REST API Sample Requests

Example requests with REST API

Amy avatar
Written by Amy
Updated over a week ago

The below sample REST API requests can be inserted and tested via our REST API Simulator in MXT.

Note: The 'Origin' field can be left blank to use a number from the SMSGlobal Shared Numbers Pool. Shared numbers may be strictly prohibited in certain countries as Sender ID or Campaign registration is mandatory. Please ensure you check our Global Sender ID Support

For example:

  • SMS to US only allows an approved US Virtual number for successful SMS, so you cannot use shared numbers.

    • "origin" : "VirtualNumber",
  • SMS to UAE only allows an approved Sender ID for successful SMS, so you cannot use shared numbers.

    • "origin" : "SenderID",

Example request body for sending SMS In REST:

Method: POST

Host: api.smsglobal.com

URI: /sms/

Body:

Type: JSON

{
"origin" : "origin",
"destination" : mobilenumber,
"message" : "Hello Test"
}

Type: XML

<messages>
<origin>INSERTORIGIN</origin>
<destination>INSERTNUMBER</destination>
<message>SMSTEXT</message>
</messages>


Example for sending to multiple destinations:

Method: POST

Host: api.smsglobal.com

URI: /sms/

Body:

{
"origin" : "origin",
"destinations" : [number, number],
"message" : "Hello Test"
}


Example for sending to multiple destinations and multiple message content:

Method: POST

Host: api.smsglobal.com

URI: /sms/

Body:

{
"messages": [{
"origin": "origin",
"destination": number1,
"message": "Hello Test from REST"
},{
"origin": "origin",
"destination": number2,
"message": "Hello Test 2 from REST"
}]
}


Example request body for sending SMS with notifyUrl and incomingUrl:

Method: POST

Host: api.smsglobal.com

URI: /sms/

Body:

{
"origin" : "origin",
"destination" : mobilenumber,
"message" : "Message content",
"notifyUrl" : "Post-back URL",
"incomingUrl" : "Post-back URL"
}


Example Request for Creating a Group in MXT

Method: POST

URI: /group/

Body:

{
"name" : "RestTest3",
"keyword" : "RestTest3",
"defaultOrigin" : "Restetest3",
"isGlobal" : true
}

Note: "defaultOrigin" can be left blank for SMSGlobal Shared Numbers Pool.


Example request to GET incoming replies

Method: GET

Host: api.smsglobal.com

URI: /sms-incoming/?startDate=2021-07-20&endDate=2021-07-30


Did this answer your question?