Getting Started
Entrust Instant ID as a Service (IIDaaS) Issuance API client provides integrations with the IIDaaS Issuance API.
Read the installation instructions before continuing.
Create an Issuance API Application in IIDaaS
Follow these steps to create an Issuance API application:
- Go to your IIDaaS Admin portal and navigate to
Adminstration > Resources > Applications
. - Click
+
to create a newIssuance API
application. - In the General tab, enter the name and the description of your application.
- Click
Next
. - In the Setup tab, assign your application the role that has the permissions needed by your application.
- Click
Submit
. - In the Complete tab, click Copy to copy the
applicationId
andsharedSecret
to your clipboard, or download the json file. You need these credentials to initialize your API application. Example:
{
"applicationId": "b0bd854d-a415-4de8-a511-66da772dd116",
"hostname": "entrust.us.trustedauth.com",
"sharedSecret": "HUsenKfwSnZ9rQENr8vXOwMVw4U9WpjM2NAqXTg0rUc"
}
The hostname
is the hostname of your IIDaaS account and the schema is https
. For example, if your IIDaaS account is
entrust.us.trustedauth.com
, then the hostname is https://entrust.us.trustedauth.com
.
The two default roles provided in Instant ID as a Service Issuance are:
- Issuance Administrator - Allows the application to both manage printers and perform print operations.
- Issuance Operator - Allows the application to perform print operations.
Initialize the Issuance API Client
In order the make the calls to the API, you need to initialize the Issuance API client using the applicationId and SharedSecret that you copied in step 7 above.
- Java
- CSharp
- Python
import com.entrustdatacard.intellitrust.issuance.ApiClient;
import com.entrustdatacard.intellitrust.issuance.api.AdminAuthApi;
import com.entrustdatacard.intellitrust.issuance.api.UsersApi;
import com.entrustdatacard.intellitrust.issuance.model.*;
public class Main {
private static final String SHARED_SECRET = "YOUR_SHARED_SECRET";
private static final String HOST_NAME = "YOUR_HOST_NAME";
private static final String APPLICATION_ID = "YOUR_APPLICATION_ID";
public static void main(String args[]) throws Exception {
// initialize the API client with the IIDaaS hostname
ApiClient apiClient = new ApiClient();
apiClient.setBasePath(HOST_NAME);
AdminAuthApi adminAuthApi = new AdminAuthApi(apiClient);
// make a request to authenticate to the issuance API application in IIDaaS
AdminApiAuthentication authParms =
new AdminApiAuthentication()
.applicationId(APPLICATION_ID)
.sharedSecret(SHARED_SECRET);
AdminApiAuthenticationResult authResult = adminAuthApi.authenticateAdminApiUsingPOST(authParms);
// after authenticating to IIDaaS, set the auth token in the API client so that it is used to authenticate
// subsequent admin calls
apiClient.setApiKey(authResult.getAuthToken());
}
}
using com.entrustdatacard.intellitrust.issuance.api;
using com.entrustdatacard.intellitrust.issuance.Client;
using com.entrustdatacard.intellitrust.issuance.model;
namespace Samples
{
internal class IssuanceApiSample
{
private static readonly string SHARED_SECRET = "YOUR_SHARED_SECRET";
private static readonly string HOST_NAME = "YOUR_HOST_NAME";
private static readonly string APPLICATION_ID = "YOUR_APPLICATION_ID";
public static void Main()
{
Configuration configuration = new Configuration();
configuration.BasePath = HOST_NAME;
AdminAuthApi adminAuthApi = new AdminAuthApi(configuration);
var authParams = new AdminApiAuthentication(APPLICATION_ID, false, SHARED_SECRET);
var authResult = adminAuthApi.AuthenticateAdminApiUsingPOST(authParams);
configuration.AddApiKey("Authorization", authResult.AuthToken);
}
}
}
from IntelliTrust_Python_Issuance import ApiClient, Configuration
import IntelliTrust_Python_Issuance.api as apis
import IntelliTrust_Python_Issuance.models as models
conf = Configuration(
host = "YOUR_HOST_NAME",
)
with ApiClient(conf) as api_client:
api_instance = apis.AdminAuthApi(api_client)
auth_parms = models.AdminApiAuthentication(
application_id="YOUR_APPLICATION_ID",
shared_secret="YOUR_SHARED_SECRET"
)
api_response = api_instance.authenticate_admin_api(auth_parms)
api_client.set_default_header("Authorization", "api_response.auth_token)
Try some API Requests
- Java
- CSharp
- Python
PrintersApi printersApi = new PrintersApi(apiClient);
List<Printer> printers = printersApi.getPrinters();
System.out.println("id,name,firmwareVersion,model,status");
for (Printer printer : printers) {
StatusEnum status = printer.getStatus();
System.out.println(printer.getId() + "," + printer.getName() + "," + printer.getFirmwareVersion() + "," + printer.getModel() + "," + status);
}
var printersApi = new PrintersApi(configuration);
var printers = printersApi.GetPrinters();
Console.WriteLine("id,name,firmwareVersion,model,status");
foreach (var printer in printers)
{
Console.WriteLine(printer.Id + "," + printer.Name + "," + printer.FirmwareVersion + "," + printer.Model + "," + printer.Status);
}
with apis.PrintersApi(api_client) as api:
printers = api.get_printers()
print("id,name,firmwareVersion,model,status")
for printer in printers:
print(printer.id + "," + printer.name + "," + printer.firmware_version + "," + printer.model + "," + printer.status)
Full Code Snippets
- Java
- CSharp
- Python
import com.entrustdatacard.intellitrust.issuance.ApiClient;
import com.entrustdatacard.intellitrust.issuance.api.AdminAuthApi;
import com.entrustdatacard.intellitrust.issuance.api.UsersApi;
import com.entrustdatacard.intellitrust.issuance.model.*;
public class Main {
private static final String SHARED_SECRET = "YOUR_SHARED_SECRET";
private static final String HOST_NAME = "YOUR_HOST_NAME";
private static final String APPLICATION_ID = "YOUR_APPLICATION_ID";
public static void main(String args[]) throws Exception {
// initialize the API client with the IIDaaS hostname
ApiClient apiClient = new ApiClient();
apiClient.setBasePath(HOST_NAME);
AdminAuthApi adminAuthApi = new AdminAuthApi(apiClient);
// make a request to authenticate to the issuance API application in IIDaaS
AdminApiAuthentication authParms =
new AdminApiAuthentication()
.applicationId(APPLICATION_ID)
.sharedSecret(SHARED_SECRET);
AdminApiAuthenticationResult authResult = adminAuthApi.authenticateAdminApiUsingPOST(authParms);
// after authenticating to IIDaaS, set the auth token in the API client so that it is used to authenticate
// subsequent admin calls
apiClient.setApiKey(authResult.getAuthToken());
PrintersApi printersApi = new PrintersApi(apiClient);
List<Printer> printers = printersApi.getPrinters();
System.out.println("id,name,firmwareVersion,model,status");
for (Printer printer : printers) {
StatusEnum status = printer.getStatus();
System.out.println(printer.getId() + "," + printer.getName() + "," + printer.getFirmwareVersion() + "," + printer.getModel() + "," + status);
}
}
}
using com.entrustdatacard.intellitrust.issuance.api;
using com.entrustdatacard.intellitrust.issuance.Client;
using com.entrustdatacard.intellitrust.issuance.model;
namespace Samples
{
internal class IssuanceApiSample
{
private static readonly string SHARED_SECRET = "YOUR_SHARED_SECRET";
private static readonly string HOST_NAME = "YOUR_HOST_NAME";
private static readonly string APPLICATION_ID = "YOUR_APPLICATION_ID";
public static void Main()
{
Configuration configuration = new Configuration();
configuration.BasePath = HOST_NAME;
AdminAuthApi adminAuthApi = new AdminAuthApi(configuration);
var authParams = new AdminApiAuthentication(APPLICATION_ID, false, SHARED_SECRET);
var authResult = adminAuthApi.AuthenticateAdminApiUsingPOST(authParams);
configuration.AddApiKey("Authorization", authResult.AuthToken);
var printersApi = new PrintersApi(configuration);
var printers = printersApi.GetPrinters();
Console.WriteLine("id,name,firmwareVersion,model,status");
foreach (var printer in printers)
{
Console.WriteLine(printer.Id + "," + printer.Name + "," + printer.FirmwareVersion + "," + printer.Model + "," + printer.Status);
}
}
}
}
from IntelliTrust_Python_Issuance import ApiClient, Configuration
import IntelliTrust_Python_Issuance.api as apis
import IntelliTrust_Python_Issuance.models as models
conf = Configuration(
host = "YOUR_HOST_NAME",
)
with ApiClient(conf) as api_client:
api_instance = apis.AdminAuthApi(api_client)
auth_parms = models.AdminApiAuthentication(
application_id="YOUR_APPLICATION_ID",
shared_secret="YOUR_SHARED_SECRET"
)
api_response = api_instance.authenticate_admin_api(auth_parms)
api_client.set_default_header("Authorization", "api_response.auth_token)
printers_api = apis.PrintersApi(api_client)
printers = printers_api.get_printers()
print("id,name,firmwareVersion,model,status")
for printer in printers:
print(printer.id + "," + printer.name + "," + printer.firmware_version + "," + printer.model + "," + printer.status)
The code samples above are provided for reference only. They are not intended to be used in production.
It is dangerous to store the shared secret as plain text in your code. You should use a secure storage tool to store the shared secret and retrieve it at runtime. In case of a security breach, you should regenerate the shared secret in your IDaaS Admin portal and update your application.