Difference between revisions of "GetMessageStatusByReferenceID"
Jump to navigation
Jump to search
imported>Nfesette |
(→JAVA) |
||
(22 intermediate revisions by 4 users not shown) | |||
Line 17: | Line 17: | ||
|} | |} | ||
+ | |||
+ | === HTTP Method === | ||
+ | |||
+ | HTTP Method: '''GET''' | ||
+ | |||
+ | Url: http://sms2.cdyne.com/sms.svc/GetMessageStatusByReferenceID?ReferenceID={REFERENCEID}&LicenseKey={LICENSEKEY} | ||
+ | |||
+ | Url: https://sms2.cdyne.com/sms.svc/GetMessageStatusByReferenceID?ReferenceID={REFERENCEID}&LicenseKey={LICENSEKEY} | ||
== GetMessageStatusByReferenceID Response == | == GetMessageStatusByReferenceID Response == | ||
Line 27: | Line 35: | ||
! '''Parameter Name''' | ! '''Parameter Name''' | ||
! align="left" | '''Data Type''' | ! align="left" | '''Data Type''' | ||
− | ! align="left" | '''Sample | + | ! align="left" | '''Sample Output''' |
+ | |- | ||
+ | |||
+ | | '''Cancelled:''' Returns true or false if the SMS message has been cancelled. | ||
+ | | ''Boolean'' | ||
+ | | False | ||
|- | |- | ||
Line 84: | Line 97: | ||
! '''SMSIncomingMessage Parameter Name''' | ! '''SMSIncomingMessage Parameter Name''' | ||
! align="left" | '''Data Type''' | ! align="left" | '''Data Type''' | ||
− | ! align="left" | '''Sample | + | ! align="left" | '''Sample Output''' |
|- | |- | ||
Line 119: | Line 132: | ||
|} | |} | ||
− | == | + | === XML Response === |
− | |||
− | |||
The following is an example response Xml body: | The following is an example response Xml body: | ||
Line 157: | Line 168: | ||
</pre> | </pre> | ||
− | == | + | === Json Response === |
− | |||
− | |||
The following is an example response Json body: | The following is an example response Json body: | ||
Line 184: | Line 193: | ||
</pre> | </pre> | ||
+ | |||
+ | == GetMessageStatusByReferenceID Code Examples == | ||
+ | |||
+ | === C#=== | ||
+ | |||
+ | <syntaxhighlight lang=csharp line=line> | ||
+ | |||
+ | GetMessageStatusByReferenceID.WSDL.IsmsClient client = new GetMessageStatusByReferenceID.WSDL.IsmsClient("sms2wsHttpBinding"); | ||
+ | GetMessageStatusByReferenceID.WSDL.SMSResponse[] resp = client.GetMessageStatusByReferenceID("123456", new Guid("YOUR LICENSE KEY")); | ||
+ | foreach (var item in resp) | ||
+ | { | ||
+ | Console.WriteLine(item.MessageID+" " + item.SentDateTime + " " + item.SMSError); | ||
+ | } | ||
+ | Console.ReadLine(); | ||
+ | Client.Close(); | ||
+ | |||
+ | </syntaxhighlight> | ||
=== VB.NET === | === VB.NET === | ||
− | < | + | <syntaxhighlight lang=vbnet line=line> |
Imports GetMessageStatusByReferenceID.WSDL | Imports GetMessageStatusByReferenceID.WSDL | ||
Line 201: | Line 227: | ||
End Module | End Module | ||
− | </ | + | </syntaxhighlight> |
=== PHP === | === PHP === | ||
− | <php> | + | <syntaxhighlight lang=php line=line> |
$client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl'); | $client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl'); | ||
$param = array( | $param = array( | ||
− | 'ReferenceID' => '(your reference ID, set in AdvancedSMSSend)' | + | 'ReferenceID' => '(your reference ID, set in AdvancedSMSSend)', |
− | + | 'LicenseKey' => '(your license key)' | |
); | ); | ||
Line 219: | Line 245: | ||
</php> | </php> | ||
+ | |||
+ | === PHP with cURL === | ||
+ | |||
+ | <php> | ||
+ | |||
+ | |||
+ | $url='http://sms2.cdyne.com/sms.svc/GetMessageStatusByReferenceID?ReferenceID=(Reference ID)&LicenseKey=(License Key)'; | ||
+ | |||
+ | $cURL = curl_init(); | ||
+ | |||
+ | curl_setopt($cURL,CURLOPT_URL,$url); | ||
+ | curl_setopt($cURL,CURLOPT_HTTPGET,true); | ||
+ | curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Accept: application/json')); | ||
+ | |||
+ | $result = curl_exec($cURL); | ||
+ | |||
+ | curl_close($cURL); | ||
+ | |||
+ | print_r($result); | ||
+ | |||
+ | </php> | ||
+ | |||
+ | === VBScript === | ||
+ | |||
+ | <syntaxhighlight lang=vb line=line> | ||
+ | |||
+ | Dim oXMLHTTP | ||
+ | Set oXMLHTTP = CreateObject("Microsoft.XMLHTTP") | ||
+ | Set oDoc = CreateObject("MSXML2.DOMDocument") | ||
+ | Call oXMLHttp.Open("GET", "http://sms2.cdyne.com/sms.svc/GetMessageStatusByReferenceID?ReferenceID=123456&LicenseKey=YOUR LICENSE KEY", False) | ||
+ | Call oXMLHttp.setRequestHeader("Content-Type", "text/xml") | ||
+ | Call oXMLHttp.send | ||
+ | MsgBox oXMLHTTP.responseText | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | === Ruby === | ||
+ | |||
+ | <syntaxhighlight lang=ruby line=line> | ||
+ | |||
+ | require 'net/http' | ||
+ | require 'URI' | ||
+ | puts URI.methods | ||
+ | url = URI.parse('http://sms2.cdyne.com/sms.svc/GetMessageStatusByReferenceID?ReferenceID=123456&LicenseKey=YOUR LICENSE KEY') | ||
+ | res = Net::HTTP.get_response(url) | ||
+ | data = res.body | ||
+ | puts data | ||
+ | gets data | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | === JAVA === | ||
+ | |||
+ | <syntaxhighlight lang=java line=line> | ||
+ | |||
+ | import java.io.ByteArrayOutputStream; | ||
+ | import java.io.InputStream; | ||
+ | import java.net.MalformedURLException; | ||
+ | import java.net.URL; | ||
+ | import java.util.Properties; | ||
+ | import javax.xml.transform.OutputKeys; | ||
+ | import javax.xml.transform.Source; | ||
+ | import javax.xml.transform.Transformer; | ||
+ | import javax.xml.transform.TransformerFactory; | ||
+ | import javax.xml.transform.stream.StreamResult; | ||
+ | import javax.xml.transform.stream.StreamSource; | ||
+ | |||
+ | public final class GetMessageStatusByReferenceID{ | ||
+ | public static void main(String[] args) { | ||
+ | |||
+ | try{ | ||
+ | URL url = new URL("http://sms2.cdyne.com/sms.svc/GetMessageStatus?" | ||
+ | + "ReferenceID=12346" | ||
+ | + "&LicenseKey=YOUR LICENSE KEY"); | ||
+ | try{ | ||
+ | InputStream in = url.openStream(); | ||
+ | StreamSource source = new StreamSource(in); | ||
+ | printResult(source); | ||
+ | }catch(java.io.IOException e){ | ||
+ | e.printStackTrace(); | ||
+ | } | ||
+ | }catch (MalformedURLException e){ | ||
+ | e.printStackTrace(); | ||
+ | } | ||
+ | } | ||
+ | private static void printResult(Source source) { | ||
+ | try { | ||
+ | ByteArrayOutputStream bos = new ByteArrayOutputStream(); | ||
+ | StreamResult sr = new StreamResult(bos); | ||
+ | Transformer trans = TransformerFactory.newInstance().newTransformer(); | ||
+ | Properties oprops = new Properties(); | ||
+ | oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes"); | ||
+ | trans.setOutputProperties(oprops); | ||
+ | trans.transform(source, sr); | ||
+ | System.out.println("**** Response ******"); | ||
+ | System.out.println(bos.toString()); | ||
+ | |||
+ | bos.close(); | ||
+ | System.out.println(); | ||
+ | } catch (Exception e) { | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </syntaxhighlight> |
Latest revision as of 11:56, 23 January 2019
This method returns all messages with a predefined user ReferenceID set in AdvancedSMSSend method.
Contents
GetMessageStatusByReferenceID Request
Parameter Name | Data Type | Sample Input |
---|---|---|
ReferenceID: Input unique ID that can be set with the AdvancedSMSSend method. | String | CDYNE Test |
HTTP Method
HTTP Method: GET
GetMessageStatusByReferenceID Response
Parameter Name | Data Type | Sample Output |
---|---|---|
Cancelled: Returns true or false if the SMS message has been cancelled. | Boolean | False |
MessageID: Returns unique Guid ID for every SMS message sent. | Guid | B01d89fd-5155-5455-5585-e84ab8de8591 |
Queued: Returns true or false if the SMS message has been queued. | Boolean | True |
ReferenceID: Returns a unique ID that is assigned during request input. (Not a required Input) | String | CDYNE Test |
SMSError: Returns a string indicating if there was an error sending the SMS message.
|
String | NoError |
SMSIncomingMessages: Returns an array of type SMSIncomingMessage | SMSIncomingMessage[] | See Table Below |
Sent: Returns true or false if the SMS message has been sent to the carrier. | Boolean | False |
SentDateTime: Returns the UTC Date and Time of when the message was sent. | Datetime | 0001-01-01T00:00:00 |
SMSIncomingMessage Parameter Name | Data Type | Sample Output |
---|---|---|
FromPhoneNumber: Returns the phone number that sent this incoming message. | String | 17575449510 |
IncomingMessageID: Returns a unique Guid ID for this incoming message. | Guid | 1835fecd-8402-4b02-91a4-5f4f9e036fe6 |
MatchedMessageID: Returns a unique Guid ID that matches the outgoing MessageID that this message is in response to. | Guid | B01d89fd-5155-5455-5585-e84ab8de8591 |
Message: Returns the content of the incoming message. | String | Ok. |
ResponseReceiveDate: Returns the UTC Date and Time of when the message was received. | DateTime | 0001-01-01T00:00:00 |
ToPhoneNumber: Returns the destination phone number of this incoming message. | String | 17577698337 |
XML Response
The following is an example response Xml body:
<SMSResponse> <Cancelled>true</Cancelled> <MessageID>1627aea5-8e0a-4371-9022-9b504344e724</MessageID> <Queued>true</Queued> <ReferenceID>String content</ReferenceID> <SMSError>NoError</SMSError> <SMSIncomingMessages> <SMSIncomingMessage> <FromPhoneNumber>String content</FromPhoneNumber> <IncomingMessageID>1627aea5-8e0a-4371-9022-9b504344e724</IncomingMessageID> <MatchedMessageID>1627aea5-8e0a-4371-9022-9b504344e724</MatchedMessageID> <Message>String content</Message> <ResponseReceiveDate>1999-05-31T11:20:00</ResponseReceiveDate> <ToPhoneNumber>String content</ToPhoneNumber> </SMSIncomingMessage> <SMSIncomingMessage> <FromPhoneNumber>String content</FromPhoneNumber> <IncomingMessageID>1627aea5-8e0a-4371-9022-9b504344e724</IncomingMessageID> <MatchedMessageID>1627aea5-8e0a-4371-9022-9b504344e724</MatchedMessageID> <Message>String content</Message> <ResponseReceiveDate>1999-05-31T11:20:00</ResponseReceiveDate> <ToPhoneNumber>String content</ToPhoneNumber> </SMSIncomingMessage> </SMSIncomingMessages> <Sent>true</Sent> <SentDateTime>1999-05-31T11:20:00</SentDateTime> </SMSResponse>
Json Response
The following is an example response Json body:
[{ "Cancelled":true, "MessageID":"1627aea5-8e0a-4371-9022-9b504344e724", "Queued":true, "ReferenceID":"String content", "SMSError":0, "SMSIncomingMessages":[{ "FromPhoneNumber":"String content", "IncomingMessageID":"1627aea5-8e0a-4371-9022-9b504344e724", "MatchedMessageID":"1627aea5-8e0a-4371-9022-9b504344e724", "Message":"String content", "ResponseReceiveDate":"\/Date(928164000000-0400)\/", "ToPhoneNumber":"String content" }], "Sent":true, "SentDateTime":"\/Date(928164000000-0400)\/" }]
GetMessageStatusByReferenceID Code Examples
C#
1 GetMessageStatusByReferenceID.WSDL.IsmsClient client = new GetMessageStatusByReferenceID.WSDL.IsmsClient("sms2wsHttpBinding");
2 GetMessageStatusByReferenceID.WSDL.SMSResponse[] resp = client.GetMessageStatusByReferenceID("123456", new Guid("YOUR LICENSE KEY"));
3 foreach (var item in resp)
4 {
5 Console.WriteLine(item.MessageID+" " + item.SentDateTime + " " + item.SMSError);
6 }
7 Console.ReadLine();
8 Client.Close();
VB.NET
1 Imports GetMessageStatusByReferenceID.WSDL
2 Module Module1
3 Sub Main()
4 Dim client As New GetMessageStatusByReferenceID.WSDL.IsmsClient("sms2wsHttpBinding")
5 Dim resp As GetMessageStatusByReferenceID.WSDL.SMSResponse() = client.GetMessageStatusByReferenceID("123456", New Guid("YOUR LICENSE KEY"))
6 For Each item In resp
7 Console.WriteLine(Convert.ToString(item.MessageID) & " " & Convert.ToString(item.SentDateTime) & " " & Convert.ToString(item.SMSError))
8 Next
9 client.Close()
10 End Sub
11 End Module
PHP
1 $client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl');
2
3 $param = array(
4 'ReferenceID' => '(your reference ID, set in AdvancedSMSSend)',
5 'LicenseKey' => '(your license key)'
6 );
7
8 $result = $client->GetMessageStatusByReferenceID($param);
9
10 print_r($result);
11
12 </php>
13
14 === PHP with cURL ===
15
16 <php>
17
18
19 $url='http://sms2.cdyne.com/sms.svc/GetMessageStatusByReferenceID?ReferenceID=(Reference ID)&LicenseKey=(License Key)';
20
21 $cURL = curl_init();
22
23 curl_setopt($cURL,CURLOPT_URL,$url);
24 curl_setopt($cURL,CURLOPT_HTTPGET,true);
25 curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Accept: application/json'));
26
27 $result = curl_exec($cURL);
28
29 curl_close($cURL);
30
31 print_r($result);
32
33 </php>
34
35 === VBScript ===
36
37 <syntaxhighlight lang=vb line=line>
38
39 Dim oXMLHTTP
40 Set oXMLHTTP = CreateObject("Microsoft.XMLHTTP")
41 Set oDoc = CreateObject("MSXML2.DOMDocument")
42 Call oXMLHttp.Open("GET", "http://sms2.cdyne.com/sms.svc/GetMessageStatusByReferenceID?ReferenceID=123456&LicenseKey=YOUR LICENSE KEY", False)
43 Call oXMLHttp.setRequestHeader("Content-Type", "text/xml")
44 Call oXMLHttp.send
45 MsgBox oXMLHTTP.responseText
Ruby
1 require 'net/http'
2 require 'URI'
3 puts URI.methods
4 url = URI.parse('http://sms2.cdyne.com/sms.svc/GetMessageStatusByReferenceID?ReferenceID=123456&LicenseKey=YOUR LICENSE KEY')
5 res = Net::HTTP.get_response(url)
6 data = res.body
7 puts data
8 gets data
JAVA
1 import java.io.ByteArrayOutputStream;
2 import java.io.InputStream;
3 import java.net.MalformedURLException;
4 import java.net.URL;
5 import java.util.Properties;
6 import javax.xml.transform.OutputKeys;
7 import javax.xml.transform.Source;
8 import javax.xml.transform.Transformer;
9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12
13 public final class GetMessageStatusByReferenceID{
14 public static void main(String[] args) {
15
16 try{
17 URL url = new URL("http://sms2.cdyne.com/sms.svc/GetMessageStatus?"
18 + "ReferenceID=12346"
19 + "&LicenseKey=YOUR LICENSE KEY");
20 try{
21 InputStream in = url.openStream();
22 StreamSource source = new StreamSource(in);
23 printResult(source);
24 }catch(java.io.IOException e){
25 e.printStackTrace();
26 }
27 }catch (MalformedURLException e){
28 e.printStackTrace();
29 }
30 }
31 private static void printResult(Source source) {
32 try {
33 ByteArrayOutputStream bos = new ByteArrayOutputStream();
34 StreamResult sr = new StreamResult(bos);
35 Transformer trans = TransformerFactory.newInstance().newTransformer();
36 Properties oprops = new Properties();
37 oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
38 trans.setOutputProperties(oprops);
39 trans.transform(source, sr);
40 System.out.println("**** Response ******");
41 System.out.println(bos.toString());
42
43 bos.close();
44 System.out.println();
45 } catch (Exception e) {
46 }
47 }
48 }