MENU
PHP CSharp Perl Ruby

Authentication API

The Authentication Service is used for tasks related to authentication. This includes creating JWT's for integration with specific webservices and creating API Keys for use with the TokenizationService. Authentication for the AuthenticationService will be done with BASIC HTTP Authorization. This includes passing a valid username and password in the header. In general, fields will only be returned if their value is not empty or null.

All requests that fail validation will return an HTTP response code 403 - Bad Request and a RequestErrorList containing details pertaining to the error(s).

Request Error List

Request Error List Object:

{
  "requestErrorList": [
    {
      "code": "ANF",
      "description": "API Key not found"
    }
  ]
}
Attribute Description
requestErrorList
ListN/A
A list of RequestError objects containing validation errors.
Details
 
code
Alpha3
The code for the validation error.
description
Alphanumeric255
The description of the validation error.

JWT

GET to retrieve an access token for authenticating to our APIs.

JWT Object

Full JWT Object >JWT Object: ```json { "accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0IiwiZXhwIjoxMDUwNTkxNjgyLCJqdGkiOiIzZGZjMzE5Ny01NjY3LTMzNDItYTZiNy01ZjVlMDQ4MjEyNWYiLCJpYXQiOjE1OTEzOTE2ODIsInNlcnZpY2VzIjpbeyJzZXJ2aWNlQWxsb3dTdGF0dXMiOiJBQ1RJVkUiLCJzZXJ2aWNlTmFtZSI6IkNBUkQifSx7InNlcnZpY2VBbGxvd1N0YXR1cyI6IkFDVElWRSIsInNlcnZpY2VOYW1lIjoiQ0hFQ0sifV0sImNvbXBhbnlBY3RpdmF0aW9uIjoiSU5BQ1RJVkUiLCAiTWVzc2FnZSI6IlRoYW5rcyBmb3IgZGVjb2RpbmcgYW5kIGNoZWNraW5nIG91dCB0aGlzIEpXVC4gSG9wZSB5b3UgbGlrZSBpdC4gVGhpcyBtZXNzYWdlIHdpbGwgbm90IGJlIGluIGEgUkVBTCBKV1QuIn0=.KRCSY7zHE5IeCnyGwrWooDgnxJjqJmQAH7uhq2hn8eU=" } ```
Attribute Description
accessToken
AlphaNumericN/A
The JWT that you will use to authenticate to PDCFlow Services.

--JWT Retrieval

GET :
test wsdl:
https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/jwts
live wsdl:
https://authentication.pdc4u.com/GWAuthentication/api/v1_0/jwts

Use a username and password to obtain a JWT for use as authentication with other PDCFlow services. This API requires a Base64 encoded username:password, passed in through the BASIC Http Authorization Header. Other than the authorization header, there are no required attributes. An example is provided below.

Sample Response:

{
  "accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0IiwiZXhwIjoxMDUwNTkxNjgyLCJqdGkiOiIzZGZjMzE5Ny01NjY3LTMzNDItYTZiNy01ZjVlMDQ4MjEyNWYiLCJpYXQiOjE1OTEzOTE2ODIsInNlcnZpY2VzIjpbeyJzZXJ2aWNlQWxsb3dTdGF0dXMiOiJBQ1RJVkUiLCJzZXJ2aWNlTmFtZSI6IkNBUkQifSx7InNlcnZpY2VBbGxvd1N0YXR1cyI6IkFDVElWRSIsInNlcnZpY2VOYW1lIjoiQ0hFQ0sifV0sImNvbXBhbnlBY3RpdmF0aW9uIjoiSU5BQ1RJVkUiLCAiTWVzc2FnZSI6IlRoYW5rcyBmb3IgZGVjb2RpbmcgYW5kIGNoZWNraW5nIG91dCB0aGlzIEpXVC4gSG9wZSB5b3UgbGlrZSBpdC4gVGhpcyBtZXNzYWdlIHdpbGwgbm90IGJlIGluIGEgUkVBTCBKV1QuIn0=.KRCSY7zHE5IeCnyGwrWooDgnxJjqJmQAH7uhq2hn8eU="
}
Deprecated endpoint details ```json { "accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0IiwiZXhwIjoxMDUwNTkxNjgyLCJqdGkiOiIzZGZjMzE5Ny01NjY3LTMzNDItYTZiNy01ZjVlMDQ4MjEyNWYiLCJpYXQiOjE1OTEzOTE2ODIsInNlcnZpY2VzIjpbeyJzZXJ2aWNlQWxsb3dTdGF0dXMiOiJBQ1RJVkUiLCJzZXJ2aWNlTmFtZSI6IkNBUkQifSx7InNlcnZpY2VBbGxvd1N0YXR1cyI6IkFDVElWRSIsInNlcnZpY2VOYW1lIjoiQ0hFQ0sifV0sImNvbXBhbnlBY3RpdmF0aW9uIjoiSU5BQ1RJVkUiLCAiTWVzc2FnZSI6IlRoYW5rcyBmb3IgZGVjb2RpbmcgYW5kIGNoZWNraW5nIG91dCB0aGlzIEpXVC4gSG9wZSB5b3UgbGlrZSBpdC4gVGhpcyBtZXNzYWdlIHdpbGwgbm90IGJlIGluIGEgUkVBTCBKV1QuIn0=.KRCSY7zHE5IeCnyGwrWooDgnxJjqJmQAH7uhq2hn8eU=", "refreshToken": "deprecatedTokenWithNoUse" } ``` test wsdl:
[https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/authentication](https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/authentication)
live wsdl:
[https://authentication.pdc4u.com/GWAuthentication/api/v1_0/authentication](https://authentication.pdc4u.com/GWAuthentication/api/v1_0/authentication)

The Deprecated endpoint returns the accessToken as documented below, and also returns a refreshToken that is no longer used in any capacity.

API Key

POST to create new api key.
PUT to deactivate an existing api key by id.
GET to retrieve list of api keys.

Use a username and password to manage API keys. These keys will be used to authenticate use of the TokenizationService. You can retrieve a list of existing keys, create a new key, or revoke an existing key.

ApiKey Object

Full ApiKey Object >JWT Object: ```json { "companyCredentialApiKeyId": "1", "companyId": "1234", "createDateTime": "2019-01-01 05:12:12", "revokeDateTime": "", "lastUsedDateTime": "2020-01-01 12:09:14", "apiKey": "c5f84322-5e11-9080-3a66-ae0d2435673c" } ```
Attribute Description
companyCredentialApiKeyId
Numeric8
The id of the API key. This will be used if you wanted to revoke access to a key.
companyId
Numeric8
The id of the company that owns the key. This will be your company id.
createDateTime
Datetime19
The date the key was created.
revokeDateTime
Datetime19
The date the key was revoked. No value if the key is still active.
lastUsedDateTime
Datetime19
The date when this key was last used for tokenization.
apiKey
Alphanumeric64
The API key to be used when attempting to tokenize a card.

--Api key list retrieval

GET : test wsdl:
https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys
live wsdl:
https://authentication.pdc4u.com/GWAuthentication/api/v1_0/apikeys


Sample Response:

{
  "apiKeyList": [
    {
        "companyCredentialApiKeyId": "1",
        "companyId": "1234",
        "createDateTime": "2019-01-01 05:12:12",
        "revokeDateTime": "",
        "lastUsedDateTime": "2020-01-01 12:09:14",
        "apiKey": "c5f84322-5e11-9080-3a66-ae0d2435673c"
    },
    {
        "companyCredentialApiKeyId": "2",
        "companyId": "1234",
        "createDateTime": "2019-01-01 09:12:12",
        "revokeDateTime": "2020-01-01 12:09:14",
        "lastUsedDateTime": "2020-01-01 04:09:14",
        "apiKey": "c5f81234-5e11-1234-3a66-ae0d2435673c"
    }
  ]
}

GET to retrieve a full list of all active and revoked API keys. There are no required parameters. View example request.

API Response

Attribute Description
apiKeyList
ListN/A
A list of apiKeyList objects containing details about each key.
Api Key Object
 
companyCredentialApiKeyId
Numeric8
The id of the API key. This will be used if you wanted to revoke access to a key.
companyId
Numeric8
The id of the company that owns the key. This will be your company id.
createDateTime
Datetime19
The date the key was created.
revokeDateTime
Datetime19
The date the key was revoked. No value if the key is still active.
lastUsedDateTime
Datetime19
The date when this key was last used for tokenization.
apiKey
Alphanumeric64
The API key to be used when attempting to tokenize a card.

--Create new key

POST to have a new key created. There are no required parameters. View example request.

POST : test wsdl:
https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys
live wsdl:
https://authentication.pdc4u.com/GWAuthentication/api/v1_0/apikeys

Sample Response:

{
    "companyCredentialApiKeyId": "3",
    "companyId": "1234",
    "createDateTime": "2020-06-01 05:12:12",
    "revokeDateTime": "",
    "lastUsedDateTime": "2020-01-01 12:09:14",
    "apiKey": "c5f84322-5e11-9080-3a66-ae0d2435673c"
}
Attribute Description
companyCredentialApiKeyId
Numeric8
The id of the API key. This will be used if you wanted to revoke access to a key.
companyId
Numeric8
The id of the company that owns the key. This will be your company id.
createDateTime
Datetime19
The date the key was created.
revokeDateTime
Datetime19
The date the key was revoked. No value if the key is still active.
lastUsedDateTime
Datetime19
The date when this key was last used for tokenization.
apiKey
Alphanumeric64
The API key to be used when attempting to tokenize a card.

--Revoke existing key

PUT test wsdl:
https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys/{id}
live wsdl:
https://authentication.pdc4u.com/GWAuthentication/api/v1_0/apikeys/{id}

PUT to revoke an existing key. The key revoked will no longer be able to be used, effective immediately.
The companyCredentialApiKeyId should be used as the numeric id submitted to revoke an apiKey. If the key to specified to be revoked is the last active key, it will not be revoked. Instead, an Http Response Code 409 will be returned. View example request.

Sample Response:

{
    "companyCredentialApiKeyId": "2",
    "companyId": "1234",
    "createDateTime": "2019-01-01 05:12:12",
    "revokeDateTime": "",
    "lastUsedDateTime": "2020-01-01 12:09:14",
    "apiKey": "c5f84322-5e11-9080-3a66-ae0d2435673c"
}
Click to view object definition
Attribute Description
companyCredentialApiKeyId
Numeric8
The id of the API key. This will be used if you wanted to revoke access to a key.
companyId
Numeric8
The id of the company that owns the key. This will be your company id.
createDateTime
Datetime19
The date the key was created.
revokeDateTime
Datetime19
The date the key was revoked. No value if the key is still active.
lastUsedDateTime
Datetime19
The date when this key was last used for tokenization.
apiKey
Alphanumeric64
The API key to be used when attempting to tokenize a card.

Sample Code

This section offers some client implementation examples in different programming languages. Keep in mind, these are only minimalistic examples used to demonstrate the Authentication 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 '404':
Description = 'The requested signature/document/image was not found.'

Status '405':
Description = 'POST, GET, PUT request not supported for resource.'

Status '409':
Description = 'Conflict. The resource could not be modified.'

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

Sample Retrieve new JWT

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;

namespace RestClient {

    public class Jwt {
        public string accessToken { get; set; }
    }

    public class MainClass {
        private HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            string url = "https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/jwts";
            GETData(url);

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        private Jwt GETData(string url) {    
            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("username:password");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            Jwt jwt = null;
            HttpResponseMessage response = await client.GetAsync(new Uri(url));
            if (response.IsSuccessStatusCode) {
                jwt = await response.Content.ReadAsAsync<jwt>();
            }

            /*
             * When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
             */

            return jwt;
        }
    }

}
<?php
$url = 'https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/jwts';

$curl = curl_init();

curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
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);  //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') {
  //Handle success
}
else {
  //Handle error according to status code
}
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://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/jwts");

   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://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/jwts"

   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

Creates a new JWT accessToken.

Send an HTTP GET request to:
test wsdl:
https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/jwts
live wsdl:
https://authentication.pdc4u.com/GWAuthentication/api/v1_0/jwts

Sample List API keys

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;

namespace RestClient {

    public class MainClass {
        private HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            string url = "https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys";
            GETData(url);

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        private bool GETData(string url) {    
            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("username:password");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            HttpResponseMessage result = client.GetAsync(new Uri(url)).Result;

            /*
             * When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
             */

            if (result.StatusCode == System.Net.HttpStatusCode.Created) {
                //parse the response
                var dataObjects = response.Content.ReadAsAsync < IEnumerable < DataObject >> ().Result;  //Make sure to add a reference to System.Net.Http.Formatting.dll
                foreach(var d in dataObjects) {
                    Console.WriteLine("{0}", d.apikey);
                }
            }
        }
    }

}
<?php
$url = 'https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys';

$curl = curl_init();

curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
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);  //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') {
  //Handle success
}
else {
  //Handle error according to status code
}
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://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys");

   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://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys"

   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

Retrieve a list of existing API keys. Send an HTTP GET request to:
test wsdl:
https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys
live wsdl:
https://authentication.pdc4u.com/GWAuthentication/api/v1_0/apikeys

Sample Add API key

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;

namespace RestClient {

    public class MainClass {
        private HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            string url = "https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys";
            POSTData(url);

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        private bool POSTData(string url) {    
            // Add an Accept header for JSON format.
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("username:password");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            /*
             * When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
             */

            HttpResponseMessage response = await client.PostAsync(new Uri(url), null);
            response.EnsureSuccessStatusCode();
        }
    }

}
<?php
$url = 'https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys';

$curl = curl_init();

curl_setopt($curl, CURLOPT_POST, 1);
$data = json_encode([], JSON_UNESCAPED_SLASHES);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Content-Length: 0'
  ]);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
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);  //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') {
  //Handle success
}
else {
  //Handle error according to status code
}
curl_close($curl);
#!/usr/bin/perl

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

eval {
   my $data = {};
   $data = JSON::XS->new->utf8->encode ($data);

   my $url = 'https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys';

   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 $response->decoded_content;
   }
   else {
      die $response->status_line . ": " . $response->decoded_content;
   }
};
if ( $@ ) {
   print "Error: $@\n";
}
#!/usr/bin/ruby

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

begin
   data = {}

   c = Curl::Easy.new
   c.url = 'https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys';
   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

Add a new API key. Send an HTTP POST request to:
test wsdl:
https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys
live wsdl:
https://authentication.pdc4u.com/GWAuthentication/api/v1_0/apikeys

Sample Revoke API key

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;

namespace RestClient {

    public class MainClass {
        private HttpClient client = new HttpClient();

        private static void Main(string[] args) {
            int apikeyId = 1234; //The id of the apikey to revoke
            string url = "https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys/"+ apikeyId;
            PUTData(url);

            //Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
            client.Dispose();
        }


        private bool PUTData(string url) {    
            // Add an Accept header for JSON format.
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            // Add authentication header (base64Encoded username:password)
            var byteArray = Encoding.ASCII.GetBytes("username:password");
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

            /*
             * When using the .NET WebClient or HTTPWebRequest API’s, the actual response content on a bad HTTP status code response (for example, 400) is not parsed. If using these libraries, it is recommended to catch a WebException and force it to read the full stream allowing the JSON response body to be read.
             */

            HttpResponseMessage response = await client.PutAsync(new Uri(url));
            response.EnsureSuccessStatusCode();
        }
    }

}
<?php
$companyCredentialApiKeyId = 1;
$url = 'https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys/' . $companyCredentialApiKeyId;


$curl = curl_init();

curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
$data = json_encode([], 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_HTTPAUTH, CURLAUTH_BASIC);
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);  //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') {
  //Handle success
}
else {
  //Handle error according to status code
}
curl_close($curl);
#!/usr/bin/perl

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

eval {
   my $companyCredentialApiKeyId = 1;
   my $url = "https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys/$companyCredentialApiKeyId";

   my $data = {};
   $data = JSON::XS->new->utf8->encode ($data);

   my $req = HTTP::Request->new( 'PUT', $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'
require 'base64'

begin
#   companyCredentialApiKeyId = 1;
   companyCredentialApiKeyId = 2560;
   url = "https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys/#{companyCredentialApiKeyId}"

   data = {}


   c = Curl::Easy.new
   c.url = url
   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_put(payload)

   #puts JSON.parse c.body_str
   puts c.body_str

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

Revoke an existing API key. Send an HTTP PUT request to:
test wsdl:
https://authenticationdemo.pdc4u.com/GWAuthentication/api/v1_0/apikeys
live wsdl:
https://authentication.pdc4u.com/GWAuthentication/api/v1_0/apikeys