Using HTTP to Send SMS

Logging in

root@multitech-MS-7253:/home/multitech/api# wget 'http://192.168.2.1/api/login?username=admin&password=admin'–2016-05-24 10:57:48– http://192.168.2.1/api/login?username=admin&password=admin
Connecting to 192.168.2.1:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: unspecified [application/json]
Saving to: login?username=admin&password=admin?
[ <=> ] 265 –.-K/s in 0s

2016-05-24 10:57:48 (16.4 MB/s) – login?username=admin&password=admin?saved [265]

Reading a token

root@multitech-MS-7253:/home/multitech/api# cat login\?username\=admin\&password\=admin
{
    "code" : 200, 
        "result" : {
        "address" : "192.168.2.13",
        "permission" : "admin", 
        "port" : "50709",
        "timestamp" : "20:54:11:830",	
        "token" : "A26A8ACCE10AEE088AE96255EC64041", 
        "user" : "admin"  
    },  
    "status" : "success"
}

Getting an inbox

root@multitech-MS-7253:/home/multitech/api# wget 'http://192.168.2.1/api/sms/inbox?token=A26A8ACCE10AEE088AE96255EC64041'–2016-05-24 10:58:26– http://192.168.2.1/api/sms/inbox?token=A26A8ACCE10AEE088AE96255EC64041
Connecting to 192.168.2.1:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: unspecified [application/json]
Saving to: inbox?token=A26A8ACCE10AEE088AE96255EC64041?
[ <=> ] 63 –.-K/s in 0s

2016-05-24 10:58:26 (3.86 MB/s) – inbox?token=A26A8ACCE10AEE088AE96255EC64041?saved [63]

Reading an inbox (returns nothing because the inbox is empty)

root@multitech-MS-7253:/home/multitech/api# cat inbox\?token\=A26A8ACCE10AEE088AE96255EC64041

{
    "code" : 200, 
    "result” : [],
    "status" : "success"
}

Sending an SMS to that inbox

GET https://192.168.2.1/api/dhcp?method=GET
root@multitech-MS-7253:/home/multitech/api# wget ‘http://192.168.2.1/api/sms/outbox?data={“recipients”: ["12345678"], “message”: “Hello World”}&token=A26A8ACCE10AEE088AE96255EC64041&method=POST’
–2016-05-24 11:00:10– http://192.168.2.1/api/sms/outbox?data=%7B%22recipients%22:%20%2212345678%22,%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041&method=POST
Connecting to 192.168.2.1:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: unspecified [application/json]
Saving to: outbox?data=%7B%22recipients%22:%20[%2212345678%22],%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041&method=POST?
[ <=> ] 45 –.-K/s in 0s

2016-05-24 11:00:10 (2.65 MB/s) – outbox?data=%7B%22recipients%22:%20[%2212345678%22],%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041&method=POST?saved [45]

Getting the outbox

root@multitech-MS-7253:/home/multitech/api# wget ‘http://192.168.2.1/api/sms/outbox?data={“recipients”: ["12345678"], “message”: “Hello World”}&token=A26A8ACCE10AEE088AE96255EC64041′
–2016-05-24 11:00:53– http://192.168.2.1/api/sms/outbox?data=%7B%22recipients%22:%20%2212345678%22,%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041
Connecting to 192.168.2.1:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: unspecified [application/json]
Saving to: outbox?data=%7B%22recipients%22:%20[%2212345678%22],%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041?
[ <=> ] 291 –.-K/s in 0s

2016-05-24 11:00:53 (11.9 MB/s) – outbox?data=%7B%22recipients%22:%20[%2212345678%22],%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041?saved [291]

Reading the outbox

root@multitech-MS-7253:/home/multitech/api# cat outbox\?data\=%7B%22recipients%22\:%20\[%2212345678%22\]\,%20%22message%22\:%20%22Hello%20World%22%7D\&token\=A26A8ACCE10AEE088AE96255EC64041

{
    "code" : 200, 
        "result" : [
        {
        "guid" : "2016052415594100",
        "message" : "Hello World", 
        "recipient" : "12345678",
        "retries" : 0, 	
        "status" : "sent", 
        "timestamp" : "2016/05/24 15:59:41" 
        }
        ],   
    “status” : “success”  
}

Getting the inbox

GET https://192.168.2.1/api/dhcp?method=GET
root@multitech-MS-7253:/home/multitech/api# wget 'http://192.168.2.1/api/sms/inbox?token=A26A8ACCE10AEE088AE96255EC64041'–2016-05-24 11:02:30– http://192.168.2.1/api/sms/inbox?token=A26A8ACCE10AEE088AE96255EC64041
Connecting to 192.168.2.1:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: unspecified [application/json]
Saving to: inbox?token=A26A8ACCE10AEE088AE96255EC64041.1?
[ <=> ] 237 –.-K/s in 0s

2016-05-24 11:02:30 (14.4 MB/s) – onbox?token=A26A8ACCE10AEE088AE96255EC64041.1?saved [237]

Reading the inbox (now contains the sent message)

root@multitech-MS-7253:/home/multitech/api# cat inbox\?token\=A26A8ACCE10AEE088AE96255EC64041.1

{
    "code" : 200, 
        "result" : [
        {
        "guid" : "2016052415595400",
        "message" : "Hello World", 
        "source" : "12345678",
        "timestamp" : "2016/05/24 15:59:54"
        }
        ], 	 
    "status" : "success" 
}