Token Server Packages#

Introduction#

The Token Server Packages are designed to accelerate your integration process. This documentation details how these packages provide efficient access to our Token Server API, enabling quicker deployment of our product within your applications.

Token Server can:
  • Authenticate access to the Global Express Entry service

  • Securely conceal a license string so it is not exposed on a public-facing web page

  • Prevent sensitive information from being passed in plain text over a network where it could be observed by a third party

Click here to learn more about the Token Server Cloud API.

Licensing#

The License Key is a software key required to use the Cloud API. You will receive your license key from your Melissa representative. If you don’t have a license key, contact the Melissa sales team at Sales@Melissa.com or 800-MELISSA ext. 3 (800-635-4772 ext. 3). Without a license key, Token Server will not function.

Initialization#

There are two different constructors that you can utilize when initializing Token Server.

TokenServer(string license)

Initialize the Cloud API object with a license key

  • C#
  • Python
TokenServer tokenServer = new TokenServer(MELISSA_LICENSE_KEY);
token_server = TokenServer(MELISSA_LICENSE_KEY)

TokenServer()

Initialize the Cloud API object, which will read the license key from the environment variable MD_LICENSE or configured using a set method

Click here to learn more about setting up the environment variable.

  • C#
  • Python
TokenServer tokenServer = new TokenServer()
token_server = TokenServer()

Configuration#

Token Server supports GET requests.

Requests#

GET#

To send a GET request, there are three ways you can configure the parameters to make a request.

  • Method 1: Using the Set Value Method to specify the parameter and value you want to set it to

  • Method 2: Using direct property access to set parameter values

  • Method 3: Using specialized Set Methods to set parameter values

Method 1: Using Set Value Method#

This function allows you to specify input parameters and the values you went to set them to.

Format

  • C#
  • Python
tokenServer.SetValue("Package", PACKAGE);
tokenServer.SetValue("Ip", IP);
tokenServer.SetValue("TimeSpan", TIME_SPAN);
token_server.set_value("package", PACKAGE);
token_server.set_value("ip", IP);
token_server.set_value("time_span", TIME_SPAN);

Example

  • C#
  • Python
tokenServer.SetValue("Package", "GlobalExpressEntry");
tokenServer.SetValue("Ip", "");
tokenServer.SetValue("TimeSpan", "0015");
token_server.set_value("package", "GlobalExpressEntry")
token_server.set_value("ip", "")
token_server.set_value("time_span", "0015")
Method 2: Using Direct Property Access#

This allows you to set values directly using the Cloud API’s parameter names.

Format

  • C#
  • Python
tokenServer.Package = PACKAGE;
tokenServer.IP = IP;
tokenServer.TimeSpan = TIME_SPAN;
token_server.package = PACKAGE
token_server.ip = IP
token_server.time_span = TIME_SPAN

Example

  • C#
  • Python
tokenServer.Package = "GlobalExpressEntry";
tokenServer.IP = "";
tokenServer.TimeSpan = "0015";
token_server.package = "GlobalExpressEntry"
token_server.ip = ""
token_server.time_span = "0015"
Method 3: Using Specialized Methods#

These functions allow you to set the input parameters for the Cloud API.

See Set Methods for a list of available parameters.

Format

  • C#
  • Python
tokenServer.SetPackage(PACKAGE);
tokenServer.SetIP(IP);
tokenServer.SetTimeSpan(TIME_SPAN);
token_server.set_package(PACKAGE)
token_server.set_ip(IP)
token_server.set_time_span(TIME_SPAN)

Example

  • C#
  • Python
tokenServer.SetPackage("GlobalExpressEntry");
tokenServer.SetIP("");
tokenServer.SetTimeSpan("0015");
token_server.set_package("GlobalExpressEntry")
token_server.set_ip("")
token_server.set_time_span("0015")

Response#

When submitting a request, you have the option to either get the response as a string or encapsulate the response into the respective Cloud API response object.

As a String#

Submit a GET or POST request and get the response as a string.

  • C#
  • Python
string response = tokenServer.Get<string>();
response = token_server.get(str)

As a Response Object#

Submit a GET request and encapsulate the response into the Cloud API response object.

  • C#
  • Python
TokenServerResponse responseObject = tokenServer.Get<TokenServerResponse>();
response = token_server.get(TokenServerResponse)
Accessing Values#

When encapsulating the response into the Cloud API’s respective response object, there are three ways to access values. The response object structure matches the respective Cloud API’s response format.

Click here to learn more about the Token Server response format.

The record responses are typically stored in a list. In the examples below, record represents an individual record at an arbitrary position within this list.

1. Using the Get Value Method:

Pass the field name as a string to the Get Value Method, and it will return the corresponding field value.

  • C#
  • Python
record.GetValue("RecordID");
record.GetValue("Results");
record.get_value("RecordID")
record.get_value("Results")

2. Accessing Properties directly

Values can be accessed directly using the response object’s field names.

  • C#
  • Python
record.RecordID;
record.Results;
record.record_id
record.results

3. Use Specialized Methods

Use get methods corresponding to field name to get the field value.

  • C#
  • Python
record.GetRecordID();
record.GetResults();
record.get_record_id()
record.get_results()

Methods#

The methods listed below pertain to the Token Server Cloud API object.

For methods related to the respective Cloud API’s response object click here.

Constructors#

These methods initialize and configure instances of the Cloud API object. Use these methods to create a new object, optionally providing initial values such as a license string to customize the instance during its creation.

  • C#
  • Python

Method

Description

TokenServer()

Constructor to initialize the Token Server object.

TokenServer(string license)

Constructor to initialize the TokenServer object with a license string.

Method

Description

TokenServer()

Constructor to initialize the Token Server object.

TokenServer(license)

Constructor to initialize the Token Server object with a license string.

Set Methods#

These methods configure or modify parameters at the record level for the Cloud API object. Use these methods to make adjustments to the parameters during the execution of the Cloud API, ensuring flexibility in customizing API requests.

  • C#
  • Python

Method

Description

void SetBaseUrl(string baseUrl)

Set the base URL.

void SetLicense(string license)

Set the license string.

void SetEndpoint(string endpoint)

Set the endpoint.

void SetFormat(string format)

Set the format.

void SetIP(string ip)

Set the IP.

void SetPackage(string package)

Set the package.

void SetTimeSpan(string timeSpan)

Set the time span.

void SetValue(string parameter, string value)

Set the input parameter to a specified value.

Method

Description

set_base_url(base_url)

Set the base URL.

set_license(license)

Set the license string.

set_endpoint(endpoint)

Set the endpoint.

set_format(format)

Set the format.

set_ip(ip)

Set the IP.

set_package(package)

Set the address line 1.

set_time_span(time_span)

Set the time span.

set_value(parameter, value)

Set the input parameter to a specified value.

Get Methods#

These methods retrieve parameter values from the Cloud API object. Use these methods to access the parameters configured for the Cloud API at the record level, providing insight into the current state of the object’s settings.

  • C#
  • Python

Method

Description

string GetBaseUrl()

Get the base URL.

string GetLicense()

Get the license string.

string GetEndpoint()

Get the endpoint.

string GetFormat()

Get the format.

string GetIP()

Get the IP.

string GetPackage()

Get the Package.

string GetTimeSpan()

Get the time span.

void GetValue(string parameter)

Get the value of an input parameter.

Method

Description

get_base_url()

Get the base URL.

get_license()

Get the license string.

get_endpoint()

Get the endpoint.

get_format()

Get the format.

get_ip()

Get the ip.

get_package()

Get the package.

get_time_span()

Get the time span.

get_value(parameter)

Get the value of an input parameter.

Class Methods#

These methods perform service-level operations, handling the core processing and interactions for the Cloud API object. Use these methods to execute primary functionalities such as assembling records, clearing records, and making API requests.

  • C#
  • Python

Method

Description

T Get<T>()

Makes the synchronous GET request to the CloudAPI and returns the response (string or deserialized response object).

async Task<T> GetAsync<T>()

Makes the asynchronous GET request to the CloudAPI and returns the response (string or deserialized response object).

string GetApiVersion()

Makes synchronous getversion request and returns parsed Cloud API version.

async Task<string> GetApiVersionAsync()

Makes asynchronous getversion request and returns parsed Cloud API version.

Method

Description

get()

Makes the synchronous GET request to the CloudAPI and returns the response (string or deserialized response object).

get_api_version()

Makes synchronous getversion request and returns parsed Cloud API version.