Melvin Chow

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Melvin Chow
    Participant

    Hi Rick,

    I think the problem here is not familiar of the JSON data structure and command sequence, and syntax etc….., to use the HTTP to send the SMS, we need to include the Token.

    I would like to list out the Multitech testing example below to help all other customer with similar problem. Honestly said I am not an expect to JSON data, and I have no intention to learn it due to this small project, but we just want to use it as application level and solve the problem.

    I hope the below http/https sms example provided by Multitech could help all other customer in the future, and solve the problem in a short time.

    here is the HTTP send SMS example from Lonny, I changed to Tel number to 12345678

    /////////////////////////////////////////////////
    ###############
    Login
    ###############
    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: 鈥榣ogin?username=admin&password=admin鈥?
    [ <=> ] 265 –.-K/s in 0s

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

    #############
    read 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”
    }

    ################
    get inbox
    ################
    root@multitech-MS-7253:/home/multitech/api# wget ‘http://192.168.2.1/api/sms/inbox?token=A26A8ACCE10AEE088AE96255EC64041&#8217;
    –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: 鈥榠nbox?token=A26A8ACCE10AEE088AE96255EC64041鈥?
    [ <=> ] 63 –.-K/s in 0s

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

    ##################
    read inbox
    note: inbox empty
    ##################
    root@multitech-MS-7253:/home/multitech/api# cat inbox\?token\=A26A8ACCE10AEE088AE96255EC64041
    {
    “code” : 200,
    “result” : [],
    “status” : “success”
    }

    ###################
    send SMS to myself
    ###################
    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%5B%2212345678%22%5D,%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: 鈥榦utbox?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) – 鈥榦utbox?data=%7B%22recipients%22:%20[%2212345678%22],%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041&method=POST鈥?saved [45]

    ############
    get 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%5B%2212345678%22%5D,%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: 鈥榦utbox?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) – 鈥榦utbox?data=%7B%22recipients%22:%20[%2212345678%22],%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041鈥?saved [291]

    #######################
    read outbox
    note: sms is in 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”
    }

    ###########
    get inbox
    ###########
    root@multitech-MS-7253:/home/multitech/api# wget ‘http://192.168.2.1/api/sms/inbox?token=A26A8ACCE10AEE088AE96255EC64041&#8217;
    –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: 鈥榠nbox?token=A26A8ACCE10AEE088AE96255EC64041.1鈥?
    [ <=> ] 237 –.-K/s in 0s

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

    #####################
    read inbox
    note: inbox now has
    received sms
    #####################

    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”
    }
    root@multitech-MS-7253:/home/multitech/api#

    ///////////////////////////////////////////
    ////////////////////////////////////////////////

    Here is the example to use HTTPS to send and receive SMS from Multitech engineer
    /////////////////////////////////////////////
    If you want to send sms using api, here is the command:

    https://192.168.2.1/api/sms/outbox?data={“recipients”: [“12345678900”], “message”: “Hello World”}&method=POST

    Notes: You can also send multiple phone numbers, just separate it with a comma. For example, “1234567890”,”0987654321″
    Is it possible to retrieve the SMS response for a message which is sent via the API? (OK, ERROR, etc.)
    Answer: https://192.168.2.1/api/sms/outbox
    ////////////////////////////////////////////////////////

Viewing 1 post (of 1 total)