Difference between revisions of "GetUnsubscribedNumbers"

From CDYNE Wiki
Jump to navigation Jump to search
imported>Bdriggers
(JSON)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
Retrieve a list of all recipient numbers who have opted out of your messaging campaign.
 +
 +
== GetUnsubscribedNumbers Request ==
 +
 +
{| class="wikitable"
 +
 +
|-
 +
! align="left" | '''Parameter Name'''
 +
! align="left" | '''Data Type'''
 +
! align="left" | '''Sample Input'''
 +
! align="left" | '''Required'''
 +
|-
 +
 +
| '''LicenseKey:''' Required to authenticate users invoking this Web Service. <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
 +
|-
 +
|}
 +
 +
== GetUnsubscribedNumbers Response ==
 +
 +
{| class="wikitable"
 +
 +
|-
 +
! align="left" | '''Parameter Name'''
 +
! align="left" | '''Data Type'''
 +
! align="left" | '''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 GET Request ==
 
<PRE>
 
<PRE>
Line 5: Line 46:
  
 
== Ruby ==
 
== Ruby ==
<code type=ruby>
+
<syntaxhighlight lang="ruby" line="line">
 
require 'net/http'
 
require 'net/http'
 
require 'URI'  
 
require 'URI'  
Line 19: Line 60:
 
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 53: Line 94:
 
}
 
}
  
</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 84: Line 125:
 
End Module
 
End Module
  
</code>
+
</syntaxhighlight>
  
 
== PHP with cURL ==
 
== PHP with cURL ==
<code type=php>
+
<syntaxhighlight lang="php" line="line">
 
<?php
 
<?php
  
Line 107: Line 148:
  
 
?>
 
?>
</code>
+
</syntaxhighlight>
  
 
== VBScript ==
 
== VBScript ==
<code type=vb>
+
<syntaxhighlight lang="vb" line="line">
  
 
Dim oXMLHTTP
 
Dim oXMLHTTP
Line 138: Line 179:
  
 
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 190: Line 231:
 
     }
 
     }
 
}
 
}
</code>
+
</syntaxhighlight>

Latest revision as of 12:14, 11 January 2019

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

VB.Net

 1 'http://messaging.cdyne.com/Messaging.svc?wsdl was added as Service Reference and given the name WSDL
 2 
 3 Imports GetUnsubscribedNumbers.WSDL
 4 
 5 Module Module1
 6 
 7     Sub Main()
 8         Dim client As WSDL.MessagingClient = New MessagingClient("mms2wsHttpBinding")
 9 
10         Dim resp As GetUnsubscribedNumbers.WSDL.UnsubscribedNumber() = client.GetUnsubscribedNumbers(New Guid("f01d89fd-5155-5455-5585-e84ab8de8591"))
11 
12         For Each item In resp
13 
14             Console.WriteLine("Phone Number: " + item.PhoneNumber + Environment.NewLine +
15                               "UTC Entry Date: " + item.EntryDate + Environment.NewLine)
16 
17         Next
18 
19         Console.ReadLine()
20 
21         client.Close()
22     End Sub
23 
24 End Module

PHP with cURL

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