GetUnsubscribedNumbers

From CDYNE Wiki
Revision as of 12:06, 11 January 2019 by Gmurdock (talk | contribs)
Jump to navigation Jump to search

Retrieve a list of all recipient numbers who have opted out of your messaging campaign.

GetUnsubscribedNumbers Request

Parameter Name Data Type Sample Input Required
LicenseKey: Required to authenticate users invoking this Web Service.
Trial Key
Production Key
GUID f01d89fd-5155-5455-5585-e84ab8de8591 TRUE

GetUnsubscribedNumbers Response

Parameter Name Data Type Sample Output
EntryDate: UTC date and time recipient unsubscribed from campaign. DateTime 1999-05-31T11:20:00
PhoneNumber: Phone number removed from recipient list. String 15551234567

HTTP GET Request

http://messaging.cdyne.com/Messaging.svc/GetUnsubscribedNumbers?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/GetUnsubscribedNumbers?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 GetUnsubscribedNumbers.WSDL;
11 
12 namespace GetUnsubscribedNumbers
13 {
14     class Program
15     {
16         static void Main(string[] args)
17         {
18             MessagingClient client = new MessagingClient("mms2wsHttpBinding");
19             UnsubscribedNumber[] resp = client.GetUnsubscribedNumbers(new Guid("f01d89fd-5155-5455-5585-e84ab8de8591"));
20 
21             foreach (var item in resp)
22             {
23                 Console.WriteLine("Phone Number: " + item.PhoneNumber + Environment.NewLine + 
24                                   "Entry Date: "+ item.EntryDate + Environment.NewLine + Environment.NewLine);
25             }
26                 Console.ReadLine();
27         }
28     }
29 }

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 GetUnsubscribedNumbers.WSDL
 6 
 7 Module Module1
 8 
 9     Sub Main()
10         Dim client As WSDL.MessagingClient = New MessagingClient("mms2wsHttpBinding")
11 
12         Dim resp As GetUnsubscribedNumbers.WSDL.UnsubscribedNumber() = client.GetUnsubscribedNumbers(New Guid("f01d89fd-5155-5455-5585-e84ab8de8591"))
13 
14         For Each item In resp
15 
16             Console.WriteLine("Phone Number: " + item.PhoneNumber + Environment.NewLine +
17                               "UTC Entry Date: " + item.EntryDate + Environment.NewLine)
18 
19         Next
20 
21         Console.ReadLine()
22 
23         client.Close()
24     End Sub
25 
26 End Module

PHP with cURL

 1 >
 2 <?php
 3 
 4 $url='http://messaging.cdyne.com/Messaging.svc/GetUnsubscribedNumbers?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 $response = curl_exec($ch); 
14 curl_close($ch); 
15 
16 $array = json_decode($response, true);
17 
18 print_r($array);
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/GetUnsubscribedNumbers?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 GetUnsubscribedNumbers {
16 
17     public static void main(String[] args) {
18 
19         try {
20             URL url = new URL("http://messaging.cdyne.com/Messaging.svc/GetUnsubscribedNumbers?"
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 }