Difference between revisions of "GetPostbackSettingsForLicenseKey"

From CDYNE Wiki
Jump to navigation Jump to search
imported>Bdriggers
(Created page with "Retrieve PostBackURL settings for SMS Notify! license key. == GetPostbackSettingsForLicenseKey Request == {| class="wikitable" |- ! align="left" | '''Parameter Name''' !...")
Line 75: Line 75:
  
 
== Ruby ==
 
== Ruby ==
<code type=ruby>
+
<syntaxhighlight lang="ruby" line="line">>
 
require 'net/http'
 
require 'net/http'
 
require 'URI'
 
require 'URI'
Line 89: Line 89:
 
puts data
 
puts data
 
gets data
 
gets data
</code>
+
</syntaxhighlight>
  
 
== C# ==
 
== C# ==
  
<code type=csharp>
+
<syntaxhighlight lang="csharp" line="line">>
  
 
/*http://messaging.cdyne.com/Messaging.svc?wsdl was added as Service Reference and given the name WSDL*/
 
/*http://messaging.cdyne.com/Messaging.svc?wsdl was added as Service Reference and given the name WSDL*/
Line 130: Line 130:
 
     }
 
     }
 
}
 
}
</code>
+
</syntaxhighlight>
  
 
== VB.Net ==
 
== VB.Net ==
  
<code type=vbnet>
+
<syntaxhighlight lang="vbnet" line="line">>
  
 
'http://messaging.cdyne.com/Messaging.svc?wsdl was added as Service Reference and given the name WSDL
 
'http://messaging.cdyne.com/Messaging.svc?wsdl was added as Service Reference and given the name WSDL
Line 168: Line 168:
 
End Module
 
End Module
  
</code>
+
</syntaxhighlight>
  
 
== PHP with cURL ==
 
== PHP with cURL ==
<code type=php>
+
<syntaxhighlight lang="php" line="line">>
 
<?php
 
<?php
  
Line 191: Line 191:
  
 
?>
 
?>
</code>
+
</syntaxhighlight>
  
 
== VBScript ==
 
== VBScript ==
<code type=vb>
+
<syntaxhighlight lang="vb" line="line">>
  
 
Dim oXMLHTTP
 
Dim oXMLHTTP
Line 222: Line 222:
  
 
set request = nothing
 
set request = nothing
</code>
+
</syntaxhighlight>
  
 
== JAVA ==
 
== JAVA ==
<code type=java>
+
<syntaxhighlight lang="java" line="line">>
  
 
import java.io.ByteArrayOutputStream;
 
import java.io.ByteArrayOutputStream;
Line 274: Line 274:
 
     }
 
     }
 
}
 
}
</code>
+
</syntaxhighlight>

Revision as of 12:09, 11 January 2019

Retrieve PostBackURL settings for SMS Notify! license key.

GetPostbackSettingsForLicenseKey Request

Parameter Name Data Type Sample Input Required
LicenseKey: License key to check PostbackURL settings.
Trial Key
Production Key
GUID f01d89fd-5155-5455-5585-e84ab8de8591 TRUE

GetPostbackSettingsForLicenseKey Response

Parameter Name Data Type Sample Output
Country: Origin country for DID/short code. String US
PhoneNumber: DID/short code being checked for PostbackURL settings. String 15551234567
PostbackEnabled: Notates if PostbackURL is enabled on DID/Short Code. Boolean true
PostbackType: Indicates whether PostBackURL is being used for incoming messages, outgoing messages, delivery receipts, or all messages associated with license key. String All
PostbackUrl: PostbackURL in use. String http://www.cdyne.com/postback.aspx
ReturnCode: Indicates if an error occurred due to the data in the request. String No Error

Complete list of return codes:

  • NoError
  • InvalidLicenseKey
  • InvaildUrl
  • InvalidPhoneNumber
  • InvalidPostbackType
  • NotFound
  • InvalidCountry

HTTP GET Request

http://messaging.cdyne.com/Messaging.svc/GetPostbackSettingsForLicenseKey?LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591

Ruby

 1 >
 2 require 'net/http'
 3 require 'URI'
 4  
 5 puts URI.methods 
 6 
 7 url = URI.parse("http://messaging.cdyne.com/Messaging.svc/GetPostbackSettingsForLicenseKey?LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591")
 8 
 9 res = Net::HTTP.get_response(url) 
10 
11 data = res.body 
12 
13 puts data
14 gets data

C#

 1 >
 2 
 3 /*http://messaging.cdyne.com/Messaging.svc?wsdl was added as Service Reference and given the name WSDL*/
 4 
 5 using System;
 6 using System.Collections.Generic;
 7 using System.Linq;
 8 using System.Text;
 9 using System.Threading.Tasks;
10 using GetPostbackSettingsForLicenseKey.WSDL;
11 
12 namespace GetPostbackSettingsForLicenseKey
13 {
14     class Program
15     {
16         static void Main(string[] args)
17         {
18             MessagingClient client = new MessagingClient("mms2wsHttpBinding");
19 
20             Array resp  = client.GetPostbackSettingsForLicenseKey(new Guid("f01d89fd-5155-5455-5585-e84ab8de8591"));
21 
22             if (resp.Length > 0)
23             {
24                 foreach (WSDL.PostbackSettingsResponse item in resp)
25             
26                     Console.WriteLine("Country: " + item.Country + Environment.NewLine +
27                         "Phone Number: " + item.PhoneNumber + Environment.NewLine +
28                          "Postback Enabled: " + item.PostbackEnabled + Environment.NewLine +
29                          "Postback Type: " + item.PostbackType + Environment.NewLine +
30                          "Postback URL: " + item.PostbackUrl + Environment.NewLine +
31                          "Return Code: " + item.ReturnCode + Environment.NewLine + Environment.NewLine);
32 
33                     Console.ReadLine();
34             }
35         }
36     }
37 }

VB.Net

 1 >
 2 
 3 'http://messaging.cdyne.com/Messaging.svc?wsdl was added as Service Reference and given the name WSDL
 4 
 5 Imports GetPostbackSettingsForLicenseKey.WSDL
 6 
 7 Module Module1
 8 
 9     Sub Main()
10 
11         Dim client As WSDL.MessagingClient = New MessagingClient("mms2wsHttpBinding")
12 
13         Dim resp As Array = client.GetPostbackSettingsForLicenseKey(New Guid("f01d89fd-5155-5455-5585-e84ab8de8591"))
14 
15         If resp.Length > 0 Then
16 
17             For Each item As WSDL.PostbackSettingsResponse In resp
18 
19                 Console.WriteLine("Country: " + Convert.ToString(item.Country) + Environment.NewLine +
20                           "Phone Number: " + Convert.ToString(item.PhoneNumber) + Environment.NewLine +
21                            "Postback Enabled: " + Convert.ToString(item.PostbackEnabled) + Environment.NewLine +
22                            "Postback Type: " + Convert.ToString(item.PostbackType) + Environment.NewLine +
23                            "Postback URL: " + Convert.ToString(item.PostbackUrl) + Environment.NewLine +
24                            "Return Code: " + Convert.ToString(item.ReturnCode) + Environment.NewLine + Environment.NewLine)
25             Next
26 
27             Console.ReadLine()
28 
29         End If
30 
31     End Sub
32 
33 End Module

PHP with cURL

 1 >
 2 <?php
 3 
 4 $url='http://messaging.cdyne.com/Messaging.svc/GetPostbackSettingsForLicenseKey?LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591';
 5 
 6 $ch = curl_init(); 
 7 
 8 curl_setopt($ch,CURLOPT_URL,$url);
 9 curl_setopt($ch,CURLOPT_HTTPGET,true);
10 curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);  
11 curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Accept: application/json'));
12 
13 //print_r($url);
14 
15 $response = curl_exec($ch); 
16 curl_close($ch); 
17 
18 print_r($response);
19 
20 ?>

VBScript

 1 >
 2 
 3 Dim oXMLHTTP
 4 Set oXMLHTTP = CreateObject("Microsoft.XMLHTTP")
 5 Set oDoc = CreateObject("MSXML2.DOMDocument")
 6 
 7 Call oXMLHttp.Open("GET", "http://messaging.cdyne.com/Messaging.svc/GetPostbackSettingsForLicenseKey?LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591", False)
 8 Call oXMLHttp.setRequestHeader("Content-Type", "text/xml")
 9 Call oXMLHttp.send
10 
11 MsgBox oXMLHTTP.responseText
12 
13 Const ForReading = 1, ForWriting = 2, ForAppending = 8
14 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
15 Dim fso, MyFile, FileName, TextLine
16 Set fso = CreateObject("Scripting.FileSystemObject")
17 FileName = "c:\Users\Desktop\MMS.txt"
18 Set MyFile = fso.OpenTextFile(FileName, ForWriting, True)
19 MyFile.WriteLine oXMLHttp.responseText
20 MyFile.Close
21 Set MyFile = fso.OpenTextFile(FileName, ForReading)
22 Do While MyFile.AtEndOfStream <> True
23 TextLine = MyFile.ReadLine
24 Loop
25 
26 MyFile.Close  
27 
28 set request = nothing

JAVA

 1 >
 2 
 3 import java.io.ByteArrayOutputStream;
 4 import java.io.InputStream;
 5 import java.net.MalformedURLException;
 6 import java.net.URL;
 7 import java.util.Properties;
 8 import javax.xml.transform.OutputKeys;
 9 import javax.xml.transform.Source;
10 import javax.xml.transform.Transformer;
11 import javax.xml.transform.TransformerFactory;
12 import javax.xml.transform.stream.StreamResult;
13 import javax.xml.transform.stream.StreamSource;
14 
15 public final class GetPostbackSettingsForLicenseKey {
16 
17     public static void main(String[] args) {
18 
19         try {
20             URL url = new URL("http://messaging.cdyne.com/Messaging.svc/GetPostbackSettingsForLicenseKey?"
21                     + "LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591");
22             try {
23                 InputStream in = url.openStream();
24                 StreamSource source = new StreamSource(in);
25                 printResult(source);
26             } catch (java.io.IOException e) {
27             }
28         } catch (MalformedURLException e) {
29         }
30     }
31 
32     private static void printResult(Source source) {
33         try {
34             ByteArrayOutputStream bos = new ByteArrayOutputStream();
35             StreamResult sr = new StreamResult(bos);
36             Transformer trans = TransformerFactory.newInstance().newTransformer();
37             Properties oprops = new Properties();
38             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
39             trans.setOutputProperties(oprops);
40             trans.transform(source, sr);
41             System.out.println("**** Response ******");
42             System.out.println(bos.toString());
43 
44             bos.close();
45             System.out.println();
46         } catch (Exception e) {
47         }
48     }
49 }