Difference between revisions of "GetMessageStatusByReferenceID"

From CDYNE Wiki
Jump to navigation Jump to search
imported>Bdriggers
imported>Bdriggers
Line 240: Line 240:
  
 
</php>
 
</php>
 +
 +
=== VBScript ===
 +
 +
<code type=vbscript>
 +
 +
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
 +
 +
</code>
 +
 +
=== Ruby ===
 +
 +
<code type=ruby>
 +
 +
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
 +
</code>

Revision as of 13:50, 2 October 2012

This method returns all messages with a predefined user ReferenceID set in AdvancedSMSSend method.

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

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


Parameter Name Data Type Sample Input
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.
  • NoError
  • STOPfromPhoneNumber
  • LicenseKeyInvalid
  • PhoneNumberInvalid
  • MessageInvalid
  • ScheduledDateTimeIsNotUTC
  • InvalidAssignedDID
  • NotFound (Occurs for Invalid MessageID)
  • InternalError
  • ContactCdyneAccountSuspended
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 Input
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#

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();

VB.NET

Imports GetMessageStatusByReferenceID.WSDL Module Module1

Sub Main()
Dim client As New GetMessageStatusByReferenceID.WSDL.IsmsClient("sms2wsHttpBinding")
Dim resp As GetMessageStatusByReferenceID.WSDL.SMSResponse() = client.GetMessageStatusByReferenceID("123456", New Guid("YOUR LICENSE KEY"))
For Each item In resp
Console.WriteLine(Convert.ToString(item.MessageID) & " " & Convert.ToString(item.SentDateTime) & " " & Convert.ToString(item.SMSError))
Next
client.Close()
End Sub

End Module

PHP

<php>

$client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl');

$param = array( 'ReferenceID' => '(your reference ID, set in AdvancedSMSSend)', 'LicenseKey' => '(your license key)' );

$result = $client->GetMessageStatusByReferenceID($param);

print_r($result);

</php>

VBScript

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

Ruby

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