HTTP POST
Mobile terminated messages
The section below contains an example of how the POST
request might look. Json text is always encoded using UTF-8.
| curl -i -X POST 'https://post.spiricom.spirius.com:55001/cgi-bin/sendsms'
-H 'Content-Type: application/json'
-d '{"User": "Username", "Pass": "Password", "To": "+46123456789", "From": "+46123456789", "Msg": "Hello world"}'
|
If everything is correct, a 202
response will be returned:
| HTTP/1.1 202 Accepted
Server: SPIRIcom/1.0
Date: Wed, 03 Oct 2018 12:01:24 GMT
Content-Length: 59
Content-type: text/html
Pragma: no-cache
Cache-Control: no-cache
Accepted for delivery, 28fc2e4a-abc2-4942-9eec-a61f9dcfb54d
|
Mobile originated messages
Push
The message below is an example of a POST
request sent from SMS Gateway, containing a MO-message. Note that the path can
specified by the client.
| POST /sms HTTP/1.1
Connection: keep-alive
User-Agent: SPIRIcom/1.0
Content-Type: application/json
Date: 2011-05-03 14:20:01
Content-Length: 148
{From": "+46712345678", "FromType": "I", "To": "+46712345678", "ToType": "I", "Msg": "Hello world", "MsgType": 0, "Timestamp": "2011-05-03 14:20:01"}
|
Pull
getnextmessage
Request
Example of getnextmessage
request:
| curl -i -X POST 'https://post2.spiricom.spirius.com:55001/cgi-bin/getnextmessage' -H 'Content-Type: application/json' -d '{"User": "Username", "Pass": "Password"}'
|
Response
Example of getnextmessage
response:
| HTTP/1.1 200 OK
Server: SPIRIcom/1.0
Date: Wed, 03 Oct 2018 13:03:57 GMT
Content-Length: 164
Content-type: text/html
Pragma: no-cache
Cache-Control: no-cache
{"Result": 1, "From": "+46123456789", "FromType": "I", "To": "+46731297001", "ToType": "I", "Msg": "Hello world ", "MsgType": 0, "Timestamp": "2018-10-03 12:55:43"}
|
getmessagelist
Request
Example of getmessagelist
request:
| curl -i -X POST 'https://post2.spiricom.spirius.com:55001/cgi-bin/getmessagelist' -H 'Content-Type: application/json' -d '{"User": "Username", "Pass": "Password"}'
|
Response
Example of getmessagelist
response:
1
2
3
4
5
6
7
8
9
10
11
12
13
14 | HTTP/1.1 200 OK
Server: SPIRIcom/1.0
Date: Wed, 03 Oct 2018 13:05:39 GMT
Content-Length: 145
Content-type: text/html
Pragma: no-cache
Cache-Control: no-cache
{"Result": 1,
"Messages": [
{"TransactionId": "61a7d183-9df7-4248-a2d6-a9bd2717ad08"},
{"TransactionId": "20c2bf35-7045-4ff9-a250-d83509963c59"}
]
}
|
getmessageforid
Request
Example of getmessageforid
request:
| curl -i -X POST 'https://post2.spiricom.spirius.com:55001/cgi-bin/getmessageforid'
-H 'Content-Type: application/json'
-d '{"User": "Username", "Pass": "Password", "TransactionId":"61a7d183-9df7-4248-a2d6-a9bd2717ad08"}'
|
Response
Example of getmessageforid
request:
| HTTP/1.1 200 OK
Server: SPIRIcom/1.0
Date: Wed, 03 Oct 2018 13:08:18 GMT
Content-Length: 164
Content-type: text/html
Pragma: no-cache
Cache-Control: no-cache
{"Result": 1, "From": "+46123456789", "FromType": "I", "To": "+46731297001", "ToType": "I", "Msg": "Hello world ", "MsgType": 0, "Timestamp": "2018-10-03 13:00:41"}
|
Delivery reports
Push
The message below is an example of a POST
request sent from SMS Gateway, containing the report for transaction ID
eda0ae82-98d7-40b3-bbaa-205b68b63c0b
, which was delivered successfully.
| POST /dlr HTTP/1.1
Connection: keep-alive
User-Agent: SPIRIcom/1.0
Content-Type: application/json
Date: 2011-05-03 14:32:07
Content-Length: 87
{"TransactionId": "eda0ae82-98d7-40b3-bbaa-205b68b63c0b", "Result": 1, "StatusCode": 1, "Timestamp": "2011-05-03 14:32:07"}
|
The message below is an example of a valid response to a delivery report. Delivery reports will be resent until
acknowledged with HTTP status code 200 OK
.
| HTTP/1.1 200 OK
Connection: close
|
Pull
The message below is an example of a POST
request sent to SMS Gateway, to request the status of transaction ID
0fa6c237-b2f1-48ca-a8d5-e2c020ff35cb
.
| curl -i -X POST 'https://post.spiricom.spirius.com:55001/cgi-bin/getmessagestatus'
-H 'Content-Type: application/json'
-d '{"User": "Username", "Pass": "Password", "TransactionId":"0fa6c237-b2f1-48ca-a8d5-e2c020ff35cb"}'
|
The message below is an example of a valid response to a delivery report pull request.
| HTTP/1.1 200 OK
Server: SPIRIcom/1.0
Date: Wed, 03 Oct 2018 13:14:42 GMT
Content-Length: 30
Content-type: text/html
Pragma: no-cache
Cache-Control: no-cache
{"Result": 1, "StatusCode": 1}
|