Difference between revisions of "GetPostbackSettingsForLicenseKey"

From CDYNE Wiki
Jump to navigation Jump to search
imported>Bdriggers
(PHP with cURL)
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== JSON ==
+
Retrieve PostBackURL settings for SMS Notify! license key.
 +
 
 +
== GetPostbackSettingsForLicenseKey Request ==
 +
 
 +
{| class="wikitable"
 +
 
 +
|-
 +
! align="left" | '''Parameter Name'''
 +
! align="left" | '''Data Type'''
 +
! align="left" | '''Sample Input'''
 +
! align="left" | '''Required'''
 +
|-
 +
 
 +
| '''LicenseKey:''' License key to check PostbackURL settings. <br>[https://cdyne.com/register?qs=34&tk=true Trial Key] <br>[https://cdyne.com/register?qs=34 Production Key]
 +
| ''GUID''
 +
| f01d89fd-5155-5455-5585-e84ab8de8591
 +
|TRUE
 +
|-
 +
|}
 +
 
 +
== GetPostbackSettingsForLicenseKey Response ==
 +
 
 +
{| class="wikitable"
 +
 
 +
|-
 +
! align="left" | '''Parameter Name'''
 +
! align="left" | '''Data Type'''
 +
! align="left" | '''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''
 +
| <nowiki>http://www.cdyne.com/postback.aspx</nowiki>
 +
|-
 +
 
 +
| '''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 ==
  
 
<PRE>
 
<PRE>
 
http://messaging.cdyne.com/Messaging.svc/GetPostbackSettingsForLicenseKey?LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591
 
http://messaging.cdyne.com/Messaging.svc/GetPostbackSettingsForLicenseKey?LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591
 
</PRE>
 
</PRE>
 +
 +
== Ruby ==
 +
<syntaxhighlight lang="ruby" line="line">
 +
require 'net/http'
 +
require 'URI'
 +
 +
puts URI.methods
 +
 +
url = URI.parse("http://messaging.cdyne.com/Messaging.svc/GetPostbackSettingsForLicenseKey?LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591")
 +
 +
res = Net::HTTP.get_response(url)
 +
 +
data = res.body
 +
 +
puts data
 +
gets data
 +
</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 44: 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 82: 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 105: Line 191:
  
 
?>
 
?>
</code>
+
</syntaxhighlight>
  
=== VBScript ===
+
== VBScript ==
<code type=vb>
+
<syntaxhighlight lang="vb" line="line">
  
 
Dim oXMLHTTP
 
Dim oXMLHTTP
Line 136: Line 222:
  
 
set request = nothing
 
set request = nothing
</code>
+
</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 GetPostbackSettingsForLicenseKey {
 +
 
 +
    public static void main(String[] args) {
 +
 
 +
        try {
 +
            URL url = new URL("http://messaging.cdyne.com/Messaging.svc/GetPostbackSettingsForLicenseKey?"
 +
                    + "LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591");
 +
            try {
 +
                InputStream in = url.openStream();
 +
                StreamSource source = new StreamSource(in);
 +
                printResult(source);
 +
            } catch (java.io.IOException e) {
 +
            }
 +
        } catch (MalformedURLException e) {
 +
        }
 +
    }
 +
 
 +
    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 12:13, 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 require 'net/http'
 2 require 'URI'
 3  
 4 puts URI.methods 
 5 
 6 url = URI.parse("http://messaging.cdyne.com/Messaging.svc/GetPostbackSettingsForLicenseKey?LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591")
 7 
 8 res = Net::HTTP.get_response(url) 
 9 
10 data = res.body 
11 
12 puts data
13 gets data

C#

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

VB.Net

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

PHP with cURL

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

VBScript

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

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