Configuring the Postman collection

Configure the global settings of the imported PKIHub collection.

To configure the PKIHub collection

  1. Click the PKIHub root node of the navigation tree.

    images/download/attachments/247055092/image-2024-5-28_15-2-1-version-1-modificationdate-1716886921616-api-v2.png
  2. In the content pane, select the Scripts tab and then Pre-request.

    images/download/attachments/247055092/image-2024-5-28_15-1-9-version-1-modificationdate-1716886870033-api-v2.png
  3. Paste the Pre-request authorization script described below.

  4. Select the Variables tab.

    images/download/attachments/247055092/image-2024-5-28_15-29-37-version-1-modificationdate-1716888578040-api-v2.png


  5. Set the baseUrl variable values described below.

  6. Click the Save icon to make the changes persistent.

Pre-request authorization script

Add the following pre-request script to generate an Authentication token before running any request.

const username = "<subjectId>";
const password = "<password>";
const idpUrl = "<idpUrl>";
const baseUrl = pm.variables.get('baseUrl');
const encodedCreds = btoa(`${username}:${password}`);
const authHeader = `Basic ${encodedCreds}`;
console.log(baseUrl);
pm.sendRequest({
url: idpUrl + "/idp/v1/tokens",
method: 'POST',
header: {
'accept': 'application/json',
'Authorization': authHeader
},
}, function (err, res) {
pm.environment.set("apiKey", res.json());
});

Where each placeholder corresponds to the following value.

<value>

Value

<subjectId> ​

The Subject ID value obtained in Getting API credentials.​

<password>

The Password value obtained in Getting API credentials.

<idpUrl>

The Identity Provider (Id) URL value obtained in Getting API credentials .

baseUrl variable

Initialize as follows the baseUrl variable.

Variable

Initial value

Current value

​baseUrl

​Clear this value and leave the column empty

Paste the RAW Signer URL value obtained when Getting API credentials .