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
URL:
https://notification.pdc4u.com/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
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. | 
Email Blocked Search
URL:
https://notification.pdc4u.com/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_OUTandBOUNCED.Valid values: OPTED_OUTBOUNCEDNote: 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 EmailBlockedobjects. | 
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 idBOUNCED- An email address was unable to be delivered | 
Email 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
URL:
https://notification.pdc4u.com/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.
Optional Parameters:
companyPhone - The sending companyPhone. If not provided, the default companyPhone will be used.
companyKey - The sending companyKey. Required if the provided companyPhone is shared.
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
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: 
 | 
| 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 POSTwhen a batchstatusisCOMPLETEDorERROR.POSTed body will be json with fields from this SMSBatchobject.
                    Constraint(s): Must be a secure HTTPS URL
                Required if postBackAuthHeaderis provided. | 
| postBackAuthHeader 
                    AlphaNumeric500
                 | An Authorization Header that will be provided when we POSTto the providedpostBackUrl. | 
| 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 SMSdefinition that will be used to replace missing properties for each entry insmsList.This object is not returned because the smsListwill be processed async by the service. | 
| smsList 
                    List - SMS1000
                 
                    Required
                 | A list of SMSobjects to process.This list is not returned because the SMSmessages will be processed async by the service. To retrieve theSMSmessages use thebatchIdListparameter on the Search Parameters.Any property not provided here will be loaded from the defaultSms | 
| requestErrorList 
                    List
                 Readonly | A list of RequestErrorobjects containing errors.Constraint(s): Only returned if  statusisERROR. | 
-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. | 
| companyKey 
                    AlphaNumeric50
                 Required | The key tied to the companyPhone | 
| 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. | 
| attachmentList 
                    List - URL500
                 | List of URL addresses for MMS media file (PDF, Image). | 
| 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: 
 | 
| latestDeliveryStatus 
                    Alpha
                 Readonly | Status of the SMS delivery process. Valid values: 
 | 
| deliveryStatusList 
                    List
                 Readonly | A list of Deliveryobjects containing the SMS delivery status progression.Properties(s): 
 | 
| postBackUrl 
                    URL500
                 Conditional | A URL to POSTwhen an SMSstatusisACCEPTED,QUEUED,SENT,DELIVERED,PARTIALLY_DELIVERED,UNDELIVEREDorFAILED.POSTed body will be json with fields from this SMSobject.Constraint(s): Must be a secure HTTPS URLRequired if postBackAuthHeaderis provided. | 
| postBackAuthHeader 
                    AlphaNumeric500
                 | An Authorization Header that will be provided when we POSTto the providedpostBackUrl. | 
| segmentCount 
                    Number
                 Readonly | If the messageis 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 processingStatusofRETRYING.Format: ISO-8601 (YYYY-MM-DDTHH:mm:ss±hh:mm) | 
| requestErrorList 
                    List
                 Readonly | A list of RequestErrorobjects containing errors.Constraint(s): Only returned if  processingStatusisFAILED. | 
SMS Batch Search
POST SMSBatchSearchParameters to search for a list of SMSBatch objects
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: 
 | 
| 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 | 
SMS Search
POST SMSSearchParameters to search for a list of SMS objects
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: 
 | 
| latestDeliveryStatusList 
                    List - Alpha
                 | List of delivery statues to search for. Valid values: 
 | 
| 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 RequestErrorobjects 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 ApiFieldNamewith the specifiedRequestError | 
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://notification.pdc4u.com/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://notification.pdc4u.com/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://notification.pdc4u.com/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
URL:
https://notification.pdc4u.com/api/v1_0/emails/validate
Sample EmailBlocked Search
<?php
$url = 'https://notification.pdc4u.com/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://notification.pdc4u.com/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://notification.pdc4u.com/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
URL:
https://notification.pdc4u.com/api/v1_0/emails/blocked/search
Sample Email Unblock
<?php
$url = 'https://notification.pdc4u.com/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://notification.pdc4u.com/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://notification.pdc4u.com/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
URL:
https://notification.pdc4u.com/api/v1_0/emails/unblock
Sample SMS Validate
<?php
$url = 'https://notification.pdc4u.com/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://notification.pdc4u.com/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://notification.pdc4u.com/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.
URL:
https://notification.pdc4u.com/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://notification.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
URL:
https://notification.pdc4u.com/api/v1_0/sms/batch
Sample 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://notification.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
URL:
https://notification.pdc4u.com/api/v1_0/sms/batch/search
Sample SMS 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://notification.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
