MENU
PHP CSharp Perl Ruby

Notification Service API

The Notification Service allows easy integration for getting data about Emails and SMS Notifications.

Authentication and authorization for the NotificationService will be done with a Base64 encoded username:password, passed in through the BASIC HTTP Authorization Header.

General Service Notes

GET Retrieve a single entity or a list of entities.
RESPONSE In general, fields will only be returned if their value is not null or empty.


Email Configuration


Test URL:
https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/emails/configure
Live URL:
https://notification.pdc4u.com/NotificationService/api/v1_0/emails/configure

Enable or Disable Email OptOut
A POST will create or update a ConfigureMail object.
A GET will retrieve a ConfigureMail object for the companyId provided.

ConfigureMail Object

Attribute Description
useOptOut
boolean
Should the company use the email OptOut logic.

Email Validate


Test URL:
https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/emails/validate
Live URL:
https://notification.pdc4u.com/NotificationService/api/v1_0/emails/validate

Validate a list of email addresses to check if they have Opted Out or Bounced.

POST an EmailAddressList object to see which email addresses have Opted Out or Bounced

If all valid an HttpStatus 200 is returned.
If any/all invalid an HttpStatus 400 is returned.

Any failures will be returned in a RequestErrorList object with an error and description for each invalid email address

Request EmailAddressList

Attribute Description
emailAddressList
Alphanumeric List75
The list of Email Addresses to validate.



Test URL:
https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/emails/blocked/search
Live URL:
https://notification.pdc4u.com/NotificationService/api/v1_0/emails/blocked/search

POST EmailBlockedSearchParameters to this url to get an EmailBlockedList containing all blocked email addresses that match the search parameters.

Request EmailBlockedSearchParameters

Attribute Description
emailAddressList
Alphanumeric List75
A list of email addresses to filter the search by.
startDate
Alphanumeric19
Starting date to limit the search by.
Format: ISO-8601 (YYYY-MM-DD HH:mm:ss)
endDate
Alphanumeric19
Ending date to limit the search by.
Format: ISO-8601 (YYYY-MM-DD HH:mm:ss)
reasonList
ListN/A
Filters results by the listed blocked reason(s). If this value is not included, results will contain emails that have been OPTED_OUT and BOUNCED.
Valid values:
OPTED_OUT
BOUNCED
Note: Other values will be ignored.
recordCount
NumericN/A
Limits the number of records returned by the search.
Default: 2000
Max: 5000
recordStart
NumericN/A
Starting index of the returned results.
Default: 0

Response EmailBlockedList

Attribute Description
emailBlockedList
ListN/A
A list of EmailBlocked objects.

EmailBlocked

Attribute Description
companyId
Numeric8
The company id associated with the email address that has been blocked.
emailAddress
Alphanumeric75
The email address that has been blocked.
date
Alphanumeric19
The date the email address was blocked.
Format: ISO-8601 (YYYY-MM-DD HH:mm:ss)
reason
Alphanumeric19
The reason the email address was blocked.
Possible values:
OPTED_OUT - A user has opted out of receiving emails from this company id
BOUNCED - An email address was unable to be delivered

Email Unblock


Test URL:
https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/emails/unblock
Live URL:
https://notification.pdc4u.com/NotificationService/api/v1_0/emails/unblock

Unblock a list of email addresses. This will remove them from the Opted Out and/or Bounced list.
NOTE: This endpoint will ignore invalid email addresses and/or those not blocked.

POST an EmailAddressList object to unblock the email addresses.

HttpStatus 200 is returned for a valid request.
HttpStatus 400 is returned for an invalid request. Errors will be provided in a RequestErrorList object.

Request EmailAddressList

Attribute Description
emailAddressList
Alphanumeric List75
The list of Email Addresses to unblock.


SMS Validate


Test URL:
https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/sms/validate/{phoneNumber}
Live URL:
https://notification.pdc4u.com/NotificationService/api/v1_0/sms/validate/{phoneNumber}

Request to validate a Phone Number. This includes checking if the Phone Number has Opted Out from receiving SMS.

GET to see if the phone number has Opted Out

If valid an HttpStatus 200 is returned.
If invalid an HttpStatus 400 is returned.

A failure will be returned in a RequestErrorList object with the error(s) and description for the invalid phone number


SMS Batch

POST an SMSBatch to create and send a list of SMS messages

Test URL:
https://notificationdemo.pdc4u.com/api/v1_0/sms/batch
Live URL:
https://notification.pdc4u.com/api/v1_0/sms/batch

Response

SMSBatch object

When the endpoint begins processing the SMS requests in the background (async), the HTTP Status will be 202 ACCEPTED

-SMSBatch

Attribute Description
batchId
NumericString20
Readonly
The auto-generated ID for the batch of SMS Messages.
externalBatchId
AlphaNumeric50
An optional ID provided for the batch of SMS Messages.
status
Alpha20
Readonly
Status of the Batch Process
Valid values:
  • PROCESSING - The batch process is running in the background.
  • COMPLETED - The batch process has finished successfully.
  • ERROR - The batch process failed. See requestErrorList for the reason(s).
dateStart
Date25
Readonly
Date the processing started.
Format: ISO-8601 (YYYY-MM-DDTHH:mm:ss±hh:mm)
dateEnd
Date25
Readonly
Date the processing ended.
Format: ISO-8601 (YYYY-MM-DDTHH:mm:ss±hh:mm)
elapsedMs
Numeric
Readonly
Number of milliseconds the processing took to finish.
username
Alphanumeric75
Optional Batch username.
description
Alphanumeric100
Optional Batch description.
postBackUrl
URL500
Conditional
A URL to POST when a batch status is COMPLETED or ERROR.
POSTed body will be json with fields from this SMSBatch object.
Constraint(s): Must be a secure HTTPS URL
Required if postBackAuthHeader is provided.
postBackAuthHeader
AlphaNumeric500
Conditional
An Authorization Header that will be provided when we POST to the provided postBackUrl.

Required if postBackUrl is provided.
countRequest
Numeric
Readonly
Number of SMS messages to process.
countSuccess
Numeric
Readonly
Number of SMS messages successfully processed.
countError
Numeric
Readonly
Number of SMS messages which had errors attempting to send.
defaultSms
SMS
Optional SMS definition that will be used to replace missing properties for each entry in smsList.
This object is not returned because the smsList will be processed async by the service.
smsList
List - SMS1000
Required
A list of SMS objects to process.
This list is not returned because the SMS messages will be processed async by the service. To retrieve the SMS messages use the batchIdList parameter on the Search Parameters.

Any property not provided here will be loaded from the defaultSms
requestErrorList
List
Readonly
A list of RequestError objects containing errors.
Constraint(s): Only returned if status is ERROR.

-SMS

Attribute Description
id
NumericString20
Readonly
The auto-generated ID for the SMS.
batchId
NumericString20
Readonly
The auto-generated ID for the batch of SMS Messages.
locationId
Numeric10
The id for the Location that the SMS is requested for.
externalId
AlphaNumeric50
An optional ID provided for the SMS Messages.
referenceType
AlphaNumeric50
An optional type of reference you are providing.
referenceValue
AlphaNumeric50
An optional value used related to the referenceType.
companyPhone
Numeric16
Required
The phone number an outgoing SMS is sent from, or an inbound SMS was sent to.
Format: ########## or +1##########
Constraint(s): This must be a valid phone number for the company.
consumerPhone
Numeric16
Required
The phone number an outgoing SMS is sent to, or an inbound SMS was sent from.
Format: ########## or +1##########
message
AlphaNumeric
Required
The message to send.
receivedDate
Date25
Readonly
Date the sms was received into the system.
Format: ISO-8601 (YYYY-MM-DDTHH:mm:ss±hh:mm)
processingStatus
Alpha
Readonly
Status of the SMS sending process.
Valid values:
  • QUEUED - The SMS has been saved, but not attempted to send yet.
  • PROCESSING - The SMS is sending.
  • SUCCESSFUL - The SMS was sent to the processing vendor.
  • RETRYING - The SMS temporarily failed to send. The system will to retry up to 5 times, each 5 minutes apart.
  • FAILED - The SMS failed. See requestErrorList for the reason(s).
latestDeliveryStatus
Alpha
Readonly
Status of the SMS delivery process.
Valid values:
  • ACCEPTED - The SMS has been accepted by the processing vendor.
  • DELIVERED - The SMS was successfully delivered.
  • UNDELIVERED - The SMS was not delivered.
  • FAILED - The SMS could not be sent.
  • RECEIVED - An inbound SMS was saved.
deliveryStatusList
List
Readonly
A list of Delivery objects containing the SMS delivery status progression.
Properties(s):
  • date - Date of the status change.
  • status - Valid values: ACCEPTED, DELIVERED, UNDELIVERED, FAILED, RECEIVED.
  • error - Error description for a FAILED or UNDELIVERED status.
postBackUrl
URL500
Conditional
A URL to POST when an SMS status is ACCEPTED, DELIVERED, UNDELIVERED or FAILED.
POSTed body will be json with fields from this SMS object.
Constraint(s): Must be a secure HTTPS URL
Required if postBackAuthHeader is provided.
postBackAuthHeader
AlphaNumeric500
Conditional
An Authorization Header that will be provided when we POST to the provided postBackUrl.

Required if postBackUrl is provided.
segmentCount
Number
Readonly
If the message is long, the vendor may split the message into smaller message segments. This is the number of segments.
nextAttemptDate
Date25
Readonly
The next time the SMS message will attempt to send. Only applies to a processingStatus of RETRYING.
Format: ISO-8601 (YYYY-MM-DDTHH:mm:ss±hh:mm)
requestErrorList
List
Readonly
A list of RequestError objects containing errors.
Constraint(s): Only returned if processingStatus is FAILED.

POST SMSBatchSearchParameters to search for a list of SMSBatch objects

Test URL:
https://notificationdemo.pdc4u.com/api/v1_0/sms/batch/search
Live URL:
https://notification.pdc4u.com/api/v1_0/sms/batch/search

Response

smsBatchList which contains a list of matching SMSBatch objects

-SMS Batch Search Parameters

Attribute Description
batchIdList
List - NumericString20
List of Batch IDs.
NOTE: This option will ignore other search options.
startDate
Date25
Date a batch process started.
Format: ISO-8601 (YYYY-MM-DDTHH:mm:ss±hh:mm)
endDate
Date25
Date a batch process ended.
Format: ISO-8601 (YYYY-MM-DDTHH:mm:ss±hh:mm)
externalBatchIdList
List - AlphaNumeric50
List of External Batch IDs to search for.
statusList
List - Alpha20
List of statues to search for.
Valid values:
  • PROCESSING
  • COMPLETED
  • ERROR
usernameList
List - Alphanumeric75
List of usernames to search for.
descriptionList
List - Alphanumeric100
List of descriptions to search for.
recordStart
Numeric
Starting index of the returned results.
Default: 0
recordCount
Numeric
Limits the number of records returned by the search.
Default: 2000
Max: 5000

POST SMSSearchParameters to search for a list of SMS objects

Test URL:
https://notificationdemo.pdc4u.com/api/v1_0/sms/search
Live URL:
https://notification.pdc4u.com/api/v1_0/sms/search

Response

smsList which contains a list of matching SMS objects

-SMS Search Parameters

Attribute Description
smsIdList
List - NumericString20
List of SMS IDs.
NOTE: This option will ignore other search options.
startDate
Date25
Start date range when an SMS was received.
Format: ISO-8601 (YYYY-MM-DDTHH:mm:ss±hh:mm)
endDate
Date25
End date range when an SMS was received.
Format: ISO-8601 (YYYY-MM-DDTHH:mm:ss±hh:mm)
batchIdList
List - NumericString20
List of Batch IDs to search for.
externalIdList
List - AlphaNumeric50
List of External IDs to search for.
referenceTypeList
List - AlphaNumeric50
List of reference types to search for.
referenceValueList
List - AlphaNumeric50
List of reference values to search for.
consumerPhoneList
List - Numeric16
List of consumer phones to search for.
processingStatusList
List - Alpha
List of processing statuses to search for.
Valid values:
  • QUEUED
  • PROCESSING
  • SUCCESSFUL
  • RETRYING
  • FAILED
latestDeliveryStatusList
List - Alpha
List of delivery statues to search for.
Valid values:
  • ACCEPTED
  • DELIVERED
  • UNDELIVERED
  • FAILED
  • RECEIVED
recordStart
Numeric
Starting index of the returned results.
Default: 0
recordCount
Numeric
Limits the number of records returned by the search.
Default: 2000
Max: 5000


REST Fault

RequestErrorList

Attribute Description
requestErrorList
ListN/A
A list of RequestError objects containing errors.
Constraint(s): Only returned when errors occur.

RequestError

Attribute Description
code
Alpha3
The code for the validation error.
errorCode
Numeric5
The error code of the validation error.
description
AlphanumericN/A
The description of the validation error.
retriable
Boolean5
Boolean to specify if the same request can be retried. This indicates a temporary failure.
apiFieldNameList
ListN/A
List of ApiFieldName with the specified RequestError

ApiFieldName

Attribute Description
apiFieldName
Alphanumeric
The name of the Api Field.
apiFieldValue
Alphanumeric
The value of the Api Field. When the Api Field is a list, this will show the specific list value which failed.



Sample Code

This section offers some client implementation examples in different languages. Keep in mind, these are only minimalistic examples used to demonstrate the Notification Service REST API and are not meant for production use.

Result Status Codes

Expected Http Status codes

Status '200':
Description = 'Success.'

Status: '400':
Description = 'Malformed request. The request is either incorrectly formatted, or there are validation errors.'

Status '401':
Description = 'Invalid credentials.'

Status '403':
Description = 'Service not activated.'

Status '404':
Description = 'The requested resource was not found.'

Status '500':
Description = 'An internal error has occurred.'

All requests will return a status code. For example, in the case of status code 400, check for a requestErrorList in the response, containing information on validation failure.

Sample Email Validate

<?php
$url = 'https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/emails/validate';

$data = [
  'emailAddressList' => [
    'email1@example.com',
    'email2@example.com'
  ]
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
$data = json_encode($data, JSON_UNESCAPED_SLASHES);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data),
  ]);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);

$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "Error #:" . $statusCode;
}
curl_close($curl);
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting

eval {
    my $data = {
        'emailAddressList' => {
            'email1@example.com',
            'email2@example.com'
        }
    }

    $data = JSON::XS->new->utf8->encode ($data);
    my $url = 'https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/emails/validate';

    my $req = HTTP::Request->new( 'POST', $url );
    $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
    $req->content_type('application/json');
    $req->content_length( length($data) );
    $req->content( $data );

    my $lwp = LWP::UserAgent->new;
    $lwp->timeout(30);
    my $response = $lwp->request( $req );

    if ( $response->is_success ) {
        print "Success: " . $response->decoded_content;
    }
    else {
        die $response->status_line . ": " . $response->decoded_content;
    }
};

if ( $@ ) {
  print "Error: $@\n";
}

#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'

begin

    data = {
        'emailAddressList' => {
            'email1@example.com',
            'email2@example.com'
        }
    }

    c = Curl::Easy.new
    c.url = 'https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/emails/validate'
    c.http_auth_types = :basic
    c.username = 'SomeSecretUsername'
    c.password = 'SomeSecretPassword'
    c.connect_timeout = 5
    c.timeout = 30
    c.verbose = true

    headers={}
    headers['Content-Type'] = 'application/json'
    headers['Content-Length'] = data.to_json.length
    payload = data.to_json

    c.headers = headers
    c.http_post(payload)

    puts JSON.parse c.body_str

    if c.response_code == 200 then
        puts "Success " + c.status
    else
        puts "Error " + c.status
    end
rescue
    puts "Caught: #$!\n"
end

POST an EmailAddressList object to see which email addresses have Opted Out or Bounced


Test URL:
https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/emails/validate
Live URL:
https://notification.pdc4u.com/NotificationService/api/v1_0/emails/validate

<?php
$url = 'https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/emails/blocked/search';

$data = [
  'emailAddressList': [
    'email1@example.com',
    'email2@example.com'
  ],
  'startDate': '2021-08-01 00:00:00',
  'endDate': '2021-08-09 23:59:59',
  'reasonList': [
    'OPTED_OUT'
  ],
  'recordCount': 5000,
  'recordStart': 0
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
$data = json_encode($data, JSON_UNESCAPED_SLASHES);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data),
  ]);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);

$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "Error #:" . $statusCode;
}
curl_close($curl);
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting

eval {
    my $data = {
        'emailAddressList': {
            'email1@example.com',
            'email2@example.com'
        },
        'startDate': '2021-08-01 00:00:00',
        'endDate': '2021-08-09 23:59:59',
        'reasonList': {
            'OPTED_OUT'
        },
        'recordCount': 5000,
        'recordStart': 0
    }

    $data = JSON::XS->new->utf8->encode ($data);
    my $url = 'https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/emails/blocked/search';

    my $req = HTTP::Request->new( 'POST', $url );
    $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
    $req->content_type('application/json');
    $req->content_length( length($data) );
    $req->content( $data );

    my $lwp = LWP::UserAgent->new;
    $lwp->timeout(30);
    my $response = $lwp->request( $req );

    if ( $response->is_success ) {
        print "Success: " . $response->decoded_content;
    }
    else {
        die $response->status_line . ": " . $response->decoded_content;
    }
};

if ( $@ ) {
  print "Error: $@\n";
}

#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'

begin

    data = {
        'emailAddressList': {
            'email1@example.com',
            'email2@example.com'
        },
        'startDate': '2021-08-01 00:00:00',
        'endDate': '2021-08-09 23:59:59',
        'reasonList': {
            'OPTED_OUT'
        },
        'recordCount': 5000,
        'recordStart': 0
    }

    c = Curl::Easy.new
    c.url = 'https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/email/validate'
    c.http_auth_types = :basic
    c.username = 'SomeSecretUsername'
    c.password = 'SomeSecretPassword'
    c.connect_timeout = 5
    c.timeout = 30
    c.verbose = true

    headers={}
    headers['Content-Type'] = 'application/json'
    headers['Content-Length'] = data.to_json.length
    payload = data.to_json

    c.headers = headers
    c.http_post(payload)

    puts JSON.parse c.body_str

    if c.response_code == 200 then
        puts "Success " + c.status
    else
        puts "Error " + c.status
    end
rescue
    puts "Caught: #$!\n"
end

POST EmailBlockedSearchParameters to search for email addresses that have been blocked


Test URL:
https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/emails/blocked/search
Live URL:
https://notification.pdc4u.com/NotificationService/api/v1_0/emails/blocked/search

Sample Email Unblock

<?php
$url = 'https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/emails/unblock';

$data = [
  'emailAddressList' => [
    'email1@example.com',
    'email2@example.com'
  ]
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
$data = json_encode($data, JSON_UNESCAPED_SLASHES);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data),
  ]);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);

$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "Error #:" . $statusCode;
}
curl_close($curl);
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting

eval {
    my $data = {
        'emailAddressList' => {
            'email1@example.com',
            'email2@example.com'
        }
    }

    $data = JSON::XS->new->utf8->encode ($data);
    my $url = 'https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/emails/unblock';

    my $req = HTTP::Request->new( 'POST', $url );
    $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );
    $req->content_type('application/json');
    $req->content_length( length($data) );
    $req->content( $data );

    my $lwp = LWP::UserAgent->new;
    $lwp->timeout(30);
    my $response = $lwp->request( $req );

    if ( $response->is_success ) {
        print "Success: " . $response->decoded_content;
    }
    else {
        die $response->status_line . ": " . $response->decoded_content;
    }
};

if ( $@ ) {
  print "Error: $@\n";
}

#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'

begin

    data = {
        'emailAddressList' => {
            'email1@example.com',
            'email2@example.com'
        }
    }

    c = Curl::Easy.new
    c.url = 'https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/emails/unblock'
    c.http_auth_types = :basic
    c.username = 'SomeSecretUsername'
    c.password = 'SomeSecretPassword'
    c.connect_timeout = 5
    c.timeout = 30
    c.verbose = true

    headers={}
    headers['Content-Type'] = 'application/json'
    headers['Content-Length'] = data.to_json.length
    payload = data.to_json

    c.headers = headers
    c.http_post(payload)

    puts JSON.parse c.body_str

    if c.response_code == 200 then
        puts "Success " + c.status
    else
        puts "Error " + c.status
    end
rescue
    puts "Caught: #$!\n"
end

POST an EmailAddressList object to unblock the email addresses


Test URL:
https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/emails/unblock
Live URL:
https://notification.pdc4u.com/NotificationService/api/v1_0/emails/unblock

Sample SMS Validate

<?php
$url = 'https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/sms/validate/1235551234';

$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  'Content-Type: application/json',
  "Authorization: BASIC " . base64_encode('companyUsername'.':'.'companyPassword')
]);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);  //num seconds to try connecting
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //max number of seconds to allow execution

$result = curl_exec($curl);
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// View response
print_r(json_decode($result, true));

if($statusCode == '200') {
  echo $result;
}
else {
  echo "Error #:" . $statusCode;
}
curl_close($curl);
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use JSON::XS;
use IO::Socket::SSL qw(debug3); # verbose for troubleshooting

eval {
   my $uri = URI->new("https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/sms/validate/1235551234");

   my $req = HTTP::Request->new( 'GET', $uri );
   $req->authorization_basic( 'SomeSecretUsername', 'SomeSecretPassword' );

   my $lwp = LWP::UserAgent->new;
   my $response = $lwp->request( $req );

   if ( $response->is_success ) {
      print "Success: " . $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

require 'curl'
require 'curb'
require 'json'

begin

   url = 'https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/sms/validate/1235551234'

   c = Curl::Easy.new( url )
   c.http_auth_types = :basic
   c.username = 'SomeSecretUsername'
   c.password = 'SomeSecretPassword'
   c.connect_timeout = 5
   c.timeout = 30
   c.verbose = true
   c.perform

   puts JSON.parse c.body_str

   if c.response_code == 200 then
      puts "Success " + c.status
   else
      puts "Error " + c.status
   end
rescue
   puts "Caught: #$!\n"
end

GET to validate a Phone Number. This includes checking if the Phone Number has Opted Out from receiving SMS.


Test URL:
https://notificationdemo.pdc4u.com/NotificationService/api/v1_0/sms/validate/{phoneNumber}
Live URL:
https://notification.pdc4u.com/NotificationService/api/v1_0/sms/validate/{phoneNumber}

Sample SMS Batch

<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://notificationdemo.pdc4u.com/api/v1_0/sms/batch',
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "externalBatchId": "myBatchId1234",
    "username": "someUserName",
    "description": "BATCH SMS Description 1234",
    "postBackUrl" => "https://www.example.com/batch",
    "postBackAuthHeader" => "BEARER batch1234...",
    "defaultSms": {
        "companyPhone": "+18015551234",
        "postBackUrl" => "https://www.example.com/sms",
        "postBackAuthHeader" => "BEARER sms1234...",
    },
    "smsList": [
        {
            "externalId": "mySmsId5678",
            "consumerPhone": "+18015555678",
            "message": "Cool Message #1"
        },
        {
            "externalId": "mySmsId6789",
            "consumerPhone": "+18015556789",
            "message": "Cool Message #2"
        }
    ]
}'));

$response = curl_exec($curl);
curl_close($curl);
echo $response;

POST an SMSBatch to create and send a list of SMS messages

Test URL:
https://notificationdemo.pdc4u.com/api/v1_0/sms/batch
Live URL:
https://notification.pdc4u.com/api/v1_0/sms/batch

<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://notificationdemo.pdc4u.com/api/v1_0/sms/batch/search',
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "startDate": "YYYY-MM-DDTHH:mm:ss±hh:mm",
    "endDate": "YYYY-MM-DDTHH:mm:ss±hh:mm",
    "externalBatchIdList": [
        "myBatchId1234","myBatchId5678"
    ],
    "statusList": [
        "PROCESSING","COMPLETED"
    ],
    "recordStart": 0,
    "recordCount": 1000
}'));

$response = curl_exec($curl);
curl_close($curl);
echo $response;

POST SMSBatchSearchParameters to search for a list of SMSBatch objects

Test URL:
https://notificationdemo.pdc4u.com/api/v1_0/sms/batch/search
Live URL:
https://notification.pdc4u.com/api/v1_0/sms/batch/search

<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "someSecretUsername:someSecretPassword");
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://notificationdemo.pdc4u.com/api/v1_0/sms/batch/search',
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "startDate": "YYYY-MM-DDTHH:mm:ss±hh:mm",
    "endDate": "YYYY-MM-DDTHH:mm:ss±hh:mm",
    "externalIdList": [
        "mySmsId5678","mySmsId6789"
    ],
    "processingStatusList": [
        "PROCESSING","SUCCESSFUL"
    ],
    "latestDeliveryStatusList": [
        "ACCEPTED","DELIVERED"
    ],
    "recordStart": 0,
    "recordCount": 1000
}'));

$response = curl_exec($curl);
curl_close($curl);
echo $response;

POST SMSSearchParameters to search for a list of SMS objects

Test URL:
https://notificationdemo.pdc4u.com/api/v1_0/sms/search
Live URL:
https://notification.pdc4u.com/api/v1_0/sms/search