Messaging Service REST API Specification V2.3.2 Last Modified: 07.October, 2016 page 1
Revision history Version Date Details Writer 1.0.0 10/16/2014 First draft Sally Han 1.1.0 11/13/2014 Revised v.1.1 document. Sally Han 1.2.0 11/14/2014 Revised v.1.2 document. Sally Han 1.3.0 11/19/2014 Revised v1.3 document. Sally Han 1.4.0 12/11/2014 Revised v1.4 document. Sally Han 1.5.0 03/02/2015 1. Changed XML parameters. (replaced _ (underscore) with - Sally Han (bar)) 2. Added Report Responses and return values. 1.6.0 03/23/2015 1. Added the description on Concatenated Message. Sally Han 2. Added the Submit packet charset field. 3. Removed to_country from the report set. 4. Added charset to the Submit field. 1.7.0 03/29/2015 1. Added the msg_type field to Response. Sally Han 2. Added rescnt to REPORT Response. 1.7.1 04/08/2015 Supplemented specification description. Sally Han 1.7.2 06/08/2015 Added the report connection information. Sally Han 1.8.0 08/17/2015 Added the MMS title field. Sally Han 1.9.0 11/03/2015 Added error codes related a Korean regulation of Sender ID. Sally Han 2.0.0 01/27/2016 1. Changed the Base URL./Added the HTTPS protocol. 2. Changed the report receiving IP. Goonghee Nam 3. Changed the result code. 4. Added the response code (credit/sender ID alteration, etc.) 5. Removed the status parameter of the result sending API. 2.1.0 2016-03-04 Changed Report format Added Sample code Goonghee Nam 2.2.0 2016-05-04 correct the Response Code : 3.4.1.1 Success example Cliff Lee <err_code>1000</err_code> <err_code>r000</err_code> 2.3.0 2016-06-01 3.3 Request format Added payment_code, client_sub_id field Goonghee Nam 2.3.1 2016-07-29 As is : path: 'sms/xml?id' + encodeuricomponent('infobank_test') To be : path: 'sms/xml?id=' + encodeuricomponent('infobank_tes t') Goonghee Nam page 2
2.3.2 2016-10-07 Added Report Return code - 3022 : Charset conversion error Goonghee Nam page 3
Table of Contents 1. INTRO... 5 2. SERVICE FLOWCHART... 5 3. MESSAGE SPECIFICATIONS... 6 3.1. BASE URL... 6 3.2. RECEIVING THE RESULT INFORMATION... 6 3.3. REQUEST FORMAT... 6 3.3.1. Example of Request... 7 3.3.1.1. PHP... 7 3.3.1.2. Shell(BASH)... 8 3.3.1.3. Python... 8 3.3.1.4. Ruby... 8 3.3.1.5. nodejs... 9 3.4. REQUEST RESPONSE FORMAT... 10 3.4.1. Example of Request Response... 10 3.4.1.1. Success... 10 3.4.1.2. Fail... 10 3.5. REPORT FORMAT... 11 3.5.1. Example of Report Format... 11 3.5.1.1. Success... 11 3.5.1.2. Failure... 12 3.6. REPORT RESPONSE FORMAT... 12 3.6.1. Example of Report Response... 12 4. RESPONSE AND RESULT CODE...12 4.1. RESPONSE RETURN CODE... 12 4.2. REPORT RETURN CODE... 13 5. APPENDIX...14 5.1. CONCATENATED SMS... 14 6. CONTACT US...14 page 4
1. Intro This document defines the protocol specification for constructing the interface that enables the Client to send SMS messages via the Infobank Server. Using the HTTP API specification (RESTful method) described in this document, the following functionality is provided: - Connecting & disconnecting to the Infobank Servers (platform) - Sending messages using HTTP, XML and plain text - Collect delivery receipt (DLR) 2. Service Flowchart 6. Response Reports Wireless Environment 1. Request HTTP: The client sends a message according to the REST API specification, using TCP/IP communication. 2. Response HTTP: The server responds to the message sending request received from the client. 3. SEND SMS: The server sends the message to the local carrier. 4. Get Reports: The server receives the message report from the local carrier. 5. Get Reports: Transfers the message report to the client, which has been sent to the server by the local carrier. 6. Response Reports: Transfers the response about the normal reception of the message report to the server. page 5
3. Message specifications HTTP METHOD - The HTTP GET/POST method is provided to make a transfer request, and the XML method is used for the transfer response. ENCODING - UTF-8 encoding is provided by default. TIMEZONE - Korean Standard Time KST (UTC+9) is used as the base time of the message. 3.1. Base URL HTTP HTTPS http://rest.supersms.co:6200/sms/xml https://rest.supersms.co/sms/xml 3.2. Receiving the result information The IP of the Infobank s server, which sends the result value, should be allowed to access and send us your IP and PORT, in order to receive the message sending result. IP information of the server that sends the result: 183.110.234.54 / 183.110.234.55 Please send your IP and PORT to support@infobank.net 3.3. Request format UTF-8 encoding is used to support various languages. [M] Mandatory, [O] Optional Parameter M/O Type Description from M Char Sender ID (up to 16bytes) e.g.,) When sending to Korea: from=821012345678 to_country M Char Country code (1 ~ 3 bytes) e.g.,) When sending to Korea: to_country=82 to M Char Recipient (up to 13bytes) e.g.,) When sending to Korea: to=1012345678 title O Char Message title (up to 40 byte) - The message title requires UTF-8 and URL encoding. - Valid only when sending LMS to Korea. message M Char Message content - The message content requires UTF-8 and URL encoding. report_req M Char Report receiving status - 1 : Reports are received. (This parameter should be set.) page 6
charset O Char Encoding setting (1: UTF-8, 2: euc-kr) - UTF-8 encoding will be applied if this parameter is not set. e.g.,) charset=2 (euc-kr) ref O Char A spare field that can be set by the user. (Up to 20bytes, alphabets/numbers only) ttl O Char Valid time of the message (in seconds) e.g.,) ttl=86400 (24hour = 60 * 60 * 24) payment_code O Char Field for separating payment by departments (Max 20 byte) client_sub_id O Char Filed for using several Sender ID and Signature (Max 20 byte) The Sender ID only supports numeric format. If a message exceeding 90bytes in size is sent to Korea, the message will be automatically switched to an LMS (MMS without an attached file). 3.3.1. Example of Request 3.3.1.1. PHP <?php $url = 'https://rest.supersms.co/sms/xml?'. http_build_query([ 'id' => 'infobank_test', 'pwd' => 'pwinfobank', 'from' => '821029652189', 'to_country' => '82', 'to' => '1093446280', 'message' => 'Hello Infobank', 'report_req' => '1' ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $xml = simplexml_load_string($response); if ($xml === false) { echo "Failed loading XML: "; } else { //print_r($xml); //echo($xml->to_country); //echo($xml->to); echo("response code : ". $xml->messages->message->err_code); page 7
}?> 3.3.1.2. Shell(BASH) #!/bin/bash curl 'https://rest.supersms.co/sms/xml' \ -d id=infobank_test \ -d pwd=pwinfobank \ -d from=821029652189 \ -d to_country=82 \ -d to=1093446280 \ --data-urlencode "message=hello Infobank" \ -d report_req=1 3.3.1.3. Python import urllib params = { 'id': 'infobank_test', 'pwd': 'pwinfobank', 'from': '821029652189', 'to_country': '82', 'to': '1093446280', 'message': 'Hello Infobank', 'report_req': '1' } url = 'https://rest.supersms.co/sms/xml?' + urllib.urlencode(params) response = urllib.urlopen(url) print response.read() 3.3.1.4. Ruby require "net/http" require "uri" uri = URI.parse("https://rest.supersms.co/sms/xml") params = { "id" => "infobank_test", page 8
} "pwd" => "pwinfobank", "from" => "821029652189", "to_country" => "82", "to" => "1093446280", "message" => "Hello Infobank", "report_req" => "1" response = Net::HTTP.post_form(uri, params) puts response.body 3.3.1.5. nodejs var https = require('https'); var options = { host: 'rest.supersms.co', path: 'sms/xml?id=' + encodeuricomponent('infobank_test') + '&pwd=' + encodeuricomponent('pwinfobank') + '&from=' + encodeuricomponent('821029652189') + '&to_country=' + encodeuricomponent('82') + '&to=' + encodeuricomponent('1093446280') + '&message=' + encodeuricomponent('hello Infobank') + '&report_req=' + encodeuricomponent(1) }; var req = https.request(options); req.end(); var responsedata = ''; req.on('response', function(res){ res.on('data', function(chunk){ responsedata += chunk; }); res.on('end', function(){ }); console.log(responsedata); page 9
}); 3.4. Request Response format Success/Failure can be checked using the response to the request. [M] Mandatory: [O] Optional: Parameter M/O Type Description msgid M Char An ID assigned to the sent message. to_country M Char Country code (1 ~ 3 bytes) e.g.,) When sending to Korea <to_country>82</to_country> to M Char Recipient err_code M Char Message sending result code messages cnt M Char Number of messages msg_type M Char Message type (1. SMS, 2. MMS) E.g.,) If the message has been sent as an MMS <msg_type>2</msg_type> ref O Char A spare field that can be set by the user. - Transfers the ref value set in Request. 3.4.1. Example of Request Response 3.4.1.1. Success <?xml version='1.0' encoding='utf-8'?> <submit_response> <to_country>82</to_country> <to>1093446280</to> <messages cnt= 1 > <message> <msgid>00000123</msgid> <err_code> R000</err_code> <msg_type>1</msg_type> </message> </messages> <ref>aa123456789</ref> </submit_response> 3.4.1.2. Fail <?xml version='1.0' encoding='utf-8'?> <submit_response> page 10
<to_country>82</to_country> <to>1093446280</to> <messages cnt= 1 > <message> <err_code>r007</err_code> </message> </messages> <ref>aa123456789</ref> </submit_response> See 4.1 Response Return Code for err_code 3.5. Report Format The report transfers the result value with the GET method, using the access information provided by the client. [M] Mandatory: [O] Optional: Parameter M/O Type Description msgid M Char An ID assigned to the sent message. to M Char Recipient (Country code should be excluded) ex) 1093446280 to_country M Char Country code of recipient number ex) 82 err_code M Char Detailed report result code network M Char Mobile network MCCMNC. (MCC: Country code, MNC: Local carrier code) e.g.,) 45005 (SKT), 45006 (LGU+), 45008 (KT) rescnt M Char Number of actual message billing cases * For concatenated messages, send the number of messages that is actually charged. sent_date O Char Time of sent - Based on Korean Standard Time: KST(UTC+9), YYYYMMDDHHMMSS ref O Char A spare field that can be set by the user. - Transfers the ref value set in Request. 3.5.1. Example of Report Format 3.5.1.1. Success?msgid =00000123&to=1093446280&to_country=82&ref=AA123456789&network=45008 &rescnt=1&err_code=1000&sent_date=20150322140641 page 11
3.5.1.2. Failure?msgid=00000123&to=1093446280&to_country=82&ref=AA123456789&network=45008&rescnt= 0&err_code=3001 See 4.2. Report Return Code for more details on err_code & status. 3.6. Report Response Format Please see 3.2 Receiving the result information to receive report. The report transfers the result value with the GET method, using the access information provided by the client. [M] Mandatory: [O] Optional: Parameter M/O Type Description msgid M Char An ID assigned to the sent message. to_country M Char Country code (1 ~ 3 bytes) e.g.,) When sending to Korea: to_country=82 To M Char Recipient 3.6.1. Example of Report Response <?xml version='1.0' encoding='utf-8'?> <report_response> <msgid>00000123</msgid> <to_country>82</to_country> <to>1093446280</to> </report_response > 4. Response and result code 4.1. Response Return Code Status code Description SUCCESS R000 Success FAILURE R001 Server busy INVALID R002 Verification failed INVALID R003 Incorrect recipients format INVALID R004 Incorrect Sender ID format INVALID R005 Invalid message format INVALID R006 Invalid TTL page 12
INVALID R007 Invalid parameter error INVALID R008 Spam filtering INVALID R009 Server capacity exceeded. Please retry. INVALID R010 Unregistered Sender ID INVALID R011 A Sender ID is used that violated the Sender ID alteration prevention standard. INVALID R012 No right to send the pertinent service type INVALID R013 Exceeded the maximum number of messages that can be sent UNKNOWN R999 Unknown error 4.2. Report Return Code Status code Description SUCCESS 1000 Success FAILURE 2000 Sending time exceeded. FAILURE 2001 Failed to send. FAILURE 2002 Failed to send. FAILURE 2003 The handset is turned off. FAILURE 2004 The handset message is full. FAILURE 2005 Shadow area FAILURE 2006 The message has been deleted. FAILURE 2007 Temporary handset problem INVALID 3000 Unable to send. INVALID 3001 No subscriber INVALID 3002 Age verification failed. INVALID 3003 Invalid recipients format INVALID 3004 Handset service suspended temporarily. INVALID 3005 Handset call processing state INVALID 3006 Declining incoming calls INVALID 3007 Handset cannot receive a callback URL. INVALID 3008 Other handset problems INVALID 3009 Invalid message format INVALID 3010 Handset that doesn t support MMS. INVALID 3011 Server error INVALID 3012 Spam INVALID 3013 Service denial INVALID 3014 Others INVALID 3015 No transmission path page 13
INVALID 3016 Failed to limit the size of the attached file. - Violated the bylaws to prevent alteration of Sender ID. - Some messages during a broadcast message violated the bylaws. INVALID 3018 Prohibited sender ID by Korean carriers. INVALID 3019 Prohibited sender ID by Korean governmental agencies. INVALID 3022 Charset conversion error 5. APPENDIX 5.1. Concatenated SMS A method of sending messages longer than 160 characters. This method is supported by some countries and local carriers. The entire message will be shown as a single message on the actual mobile phone. It is charged according to the number of characters, based on one standard SMS message. When concatenated SMS messages are used, the code to process a long message is included. As a result, 153 characters are considered as the maximum message length when charging the fee. For example, if a 350 character-long message is sent to a country that uses a 160 character-long SMS message as a standard, the fee of three messages will be charged (153 characters + 153 characters + 44 characters = 350 characters). 6. Contact Us For any inquiries or comment about these specifications, please send us an e-mail (support@infobank.net). page 14