{"id":14533,"date":"2016-08-16T10:25:37","date_gmt":"2016-08-16T15:25:37","guid":{"rendered":"http:\/\/www.multitech.net\/developer\/?page_id=14533"},"modified":"2016-08-16T10:25:37","modified_gmt":"2016-08-16T15:25:37","slug":"send_sms","status":"publish","type":"page","link":"https:\/\/www.multitech.net\/developer\/software\/mtr-software\/mtr-api-reference\/rcell_api_requests\/making-requests\/send_sms\/","title":{"rendered":"Using HTTP to Send SMS"},"content":{"rendered":"<p><strong>Logging in<\/strong><\/p>\n<pre class=\"brush:xml\">root@multitech-MS-7253:\/home\/multitech\/api# wget 'http:\/\/192.168.2.1\/api\/login?username=admin&password=admin'\u20132016-05-24 10:57:48\u2013 http:\/\/192.168.2.1\/api\/login?username=admin&password=admin\r\nConnecting to 192.168.2.1:80\u2026 connected.\r\nHTTP request sent, awaiting response\u2026 200 OK\r\nLength: unspecified [application\/json]\r\nSaving to: login?username=admin&password=admin?\r\n[ <=> ] 265 \u2013.-K\/s in 0s\r\n\r\n2016-05-24 10:57:48 (16.4 MB\/s) \u2013 login?username=admin&password=admin?saved [265]<\/pre>\n<p><strong>Reading a token<\/strong><\/p>\n<pre class=\"brush:xml\">root@multitech-MS-7253:\/home\/multitech\/api# cat login\\?username\\=admin\\&password\\=admin\r\n{\r\n    \"code\" : 200, \r\n        \"result\" : {\r\n        \"address\" : \"192.168.2.13\",\r\n        \"permission\" : \"admin\", \r\n        \"port\" : \"50709\",\r\n        \"timestamp\" : \"20:54:11:830\",\t\r\n        \"token\" : \"A26A8ACCE10AEE088AE96255EC64041\", \r\n        \"user\" : \"admin\"  \r\n    },  \r\n    \"status\" : \"success\"\r\n}<\/pre>\n<p><strong>Getting an inbox<\/strong><\/p>\n<pre class=\"brush:xml\">root@multitech-MS-7253:\/home\/multitech\/api# wget 'http:\/\/192.168.2.1\/api\/sms\/inbox?token=A26A8ACCE10AEE088AE96255EC64041'\u20132016-05-24 10:58:26\u2013 http:\/\/192.168.2.1\/api\/sms\/inbox?token=A26A8ACCE10AEE088AE96255EC64041\r\nConnecting to 192.168.2.1:80\u2026 connected.\r\nHTTP request sent, awaiting response\u2026 200 OK\r\nLength: unspecified [application\/json]\r\nSaving to: inbox?token=A26A8ACCE10AEE088AE96255EC64041?\r\n[ <=> ] 63 \u2013.-K\/s in 0s\r\n\r\n2016-05-24 10:58:26 (3.86 MB\/s) \u2013 inbox?token=A26A8ACCE10AEE088AE96255EC64041?saved [63]<\/pre>\n<p><strong>Reading an inbox <\/strong>(returns nothing because the inbox is empty)<\/p>\n<pre class=\"brush:xml\">root@multitech-MS-7253:\/home\/multitech\/api# cat inbox\\?token\\=A26A8ACCE10AEE088AE96255EC64041\r\n\r\n{\r\n    \"code\" : 200, \r\n    \"result\u201d : [],\r\n    \"status\" : \"success\"\r\n}<\/pre>\n<p><strong>Sending an SMS to that inbox<\/strong><\/p>\n<pre class=\"brush:xml\">GET https:\/\/192.168.2.1\/api\/dhcp?method=GET\r\nroot@multitech-MS-7253:\/home\/multitech\/api# wget \u2018http:\/\/192.168.2.1\/api\/sms\/outbox?data={\u201crecipients\u201d: [\"12345678\"], \u201cmessage\u201d: \u201cHello World\u201d}&token=A26A8ACCE10AEE088AE96255EC64041&method=POST\u2019\r\n\u20132016-05-24 11:00:10\u2013 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\r\nConnecting to 192.168.2.1:80\u2026 connected.\r\nHTTP request sent, awaiting response\u2026 200 OK\r\nLength: unspecified [application\/json]\r\nSaving to: outbox?data=%7B%22recipients%22:%20[%2212345678%22],%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041&method=POST?\r\n[ <=> ] 45 \u2013.-K\/s in 0s\r\n\r\n2016-05-24 11:00:10 (2.65 MB\/s) \u2013 outbox?data=%7B%22recipients%22:%20[%2212345678%22],%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041&method=POST?saved [45]<\/pre>\n<p><strong>Getting the outbox<\/strong><\/p>\n<pre class=\"brush:xml\">root@multitech-MS-7253:\/home\/multitech\/api# wget \u2018http:\/\/192.168.2.1\/api\/sms\/outbox?data={\u201crecipients\u201d: [\"12345678\"], \u201cmessage\u201d: \u201cHello World\u201d}&token=A26A8ACCE10AEE088AE96255EC64041\u2032\r\n\u20132016-05-24 11:00:53\u2013 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\r\nConnecting to 192.168.2.1:80\u2026 connected.\r\nHTTP request sent, awaiting response\u2026 200 OK\r\nLength: unspecified [application\/json]\r\nSaving to: outbox?data=%7B%22recipients%22:%20[%2212345678%22],%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041?\r\n[ <=> ] 291 \u2013.-K\/s in 0s\r\n\r\n2016-05-24 11:00:53 (11.9 MB\/s) \u2013 outbox?data=%7B%22recipients%22:%20[%2212345678%22],%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041?saved [291]<\/pre>\n<p><strong>Reading the outbox<\/strong><\/p>\n<pre class=\"brush:xml\">\r\nroot@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\r\n\r\n{\r\n    \"code\" : 200, \r\n        \"result\" : [\r\n        {\r\n        \"guid\" : \"2016052415594100\",\r\n        \"message\" : \"Hello World\", \r\n        \"recipient\" : \"12345678\",\r\n        \"retries\" : 0, \t\r\n        \"status\" : \"sent\", \r\n        \"timestamp\" : \"2016\/05\/24 15:59:41\" \r\n        }\r\n        ],   \r\n    \u201cstatus\u201d : \u201csuccess\u201d  \r\n}<\/pre>\n<p><strong>Getting the inbox<\/strong><\/p>\n<pre class=\"brush:xml\">GET https:\/\/192.168.2.1\/api\/dhcp?method=GET\r\nroot@multitech-MS-7253:\/home\/multitech\/api# wget 'http:\/\/192.168.2.1\/api\/sms\/inbox?token=A26A8ACCE10AEE088AE96255EC64041'\u20132016-05-24 11:02:30\u2013 http:\/\/192.168.2.1\/api\/sms\/inbox?token=A26A8ACCE10AEE088AE96255EC64041\r\nConnecting to 192.168.2.1:80\u2026 connected.\r\nHTTP request sent, awaiting response\u2026 200 OK\r\nLength: unspecified [application\/json]\r\nSaving to: inbox?token=A26A8ACCE10AEE088AE96255EC64041.1?\r\n[ <=> ] 237 \u2013.-K\/s in 0s\r\n\r\n2016-05-24 11:02:30 (14.4 MB\/s) \u2013 onbox?token=A26A8ACCE10AEE088AE96255EC64041.1?saved [237]<\/pre>\n<p><strong>Reading the inbox<\/strong> (now contains the sent message)<\/p>\n<pre class=\"brush:xml\">root@multitech-MS-7253:\/home\/multitech\/api# cat inbox\\?token\\=A26A8ACCE10AEE088AE96255EC64041.1\r\n\r\n{\r\n    \"code\" : 200, \r\n        \"result\" : [\r\n        {\r\n        \"guid\" : \"2016052415595400\",\r\n        \"message\" : \"Hello World\", \r\n        \"source\" : \"12345678\",\r\n        \"timestamp\" : \"2016\/05\/24 15:59:54\"\r\n        }\r\n        ], \t \r\n    \"status\" : \"success\" \r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Logging in root@multitech-MS-7253:\/home\/multitech\/api# wget &#8216;http:\/\/192.168.2.1\/api\/login?username=admin&#038;password=admin&#8217;\u20132016-05-24 10:57:48\u2013 http:\/\/192.168.2.1\/api\/login?username=admin&#038;password=admin Connecting to 192.168.2.1:80\u2026 connected. HTTP request sent, awaiting response\u2026 200 OK Length: unspecified [application\/json] Saving to: login?username=admin&#038;password=admin? [ ] 265 \u2013.-K\/s in 0s 2016-05-24 10:57:48 (16.4 MB\/s) \u2013 login?username=admin&#038;password=admin?saved [265] Reading a token root@multitech-MS-7253:\/home\/multitech\/api# cat login\\?username\\=admin\\&#038;password\\=admin { &#8220;code&#8221; : 200, &#8220;result&#8221; : { &#8220;address&#8221; : &#8220;192.168.2.13&#8221;, &#8220;permission&#8221; : [&hellip;]<\/p>\n","protected":false},"author":1872,"featured_media":0,"parent":12981,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-14533","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/14533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/users\/1872"}],"replies":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/comments?post=14533"}],"version-history":[{"count":10,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/14533\/revisions"}],"predecessor-version":[{"id":28602,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/14533\/revisions\/28602"}],"up":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/12981"}],"wp:attachment":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/media?parent=14533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}