Postman Collection

DataGuard CPM provides a Postman collection to help you get started with the Consent State API quickly and easily. The Consent State API is designed to facilitate the creation of custom consent capture points where you have full control over how it is rendered.

Consent State API Overview

The Consent State API consists of two primary endpoints:

  • GET Endpoint: Fetches the data based on a Template. This data is structured in a way that makes it easy to render the consent capture point.
  • POST Endpoint: Submits the modified data to update a Citizen's permissions and preferences.

How It Works

The data structure returned by the GET endpoint is identical to the structure expected by the POST endpoint. This design allows you to:

  1. Fetch the data using the GET endpoint.
  2. Render the data in your UI.
  3. Modify the data model as the user opts in or out.
  4. Send the modified data back to DataGuard CPM using the POST endpoint.

For a detailed, step-by-step guide on how to implement this process, refer to our How-to Guide.

Postman Collection Setup

The Postman collection allows you to test these endpoints and become familiar with how the Consent State API works.

Setting Up the Postman Environment

Follow these steps to set up the Postman environment:

  1. Download the Postman Collection: You can download the collection from our GitHub repository here.

  2. Import Environment Files:

    • Open Postman and click on the "Import" button.
    • Select the environment file(s) from the environments folder (there are four files: Testing, Sandbox, Prod EU, and Prod UK).
    • Choose the file(s) corresponding to your environment and click "Save".
  3. Enter Your Credentials:

    • Go to the Credentials page of the CPM UI to find your Client Id, Client Secret and Application Id.
    • Enter your Client Id into the auth0-client-id field.
    • Enter your Client Secret into the auth0-client-secret field.
    • Enter your Application Id into the app-id field.

Setting Up the Postman Collection

To set up the Postman collection:

  1. Import the Collection:

    • Click "Import" in Postman.
    • Select the DG CPM.postman_collection.json file.
    • Click "Save" to add the collection to your workspace.
  2. Create a JWT:

    • Use the Get DG CPM JWT request in the collection to generate a JWT. This JWT will be cached in your Postman variables.
    • Note: Only request a new JWT once every 24 hours, as JWTs have a 24-hour expiration. For more information on JWT caching, refer to the Authentication page.
  3. Set Up Authorisation:

    • Ensure that the {{dg-cpm-token}} variable is set up as the Bearer token for Authorization in your consent state requests.
  4. Test the Endpoints:

    • Use the GET state endpoint to retrieve data using a template id. Optionally, you can provide an external reference for a Citizen.
    • Use the POST state endpoint to submit the modified data model returned from the GET request.
    • You can test these endpoints in Postman to familiarize yourself with how they work. When rendering the data model in your custom UI, refer to the step-by-step How-to Guide.

Summary

Using the DataGuard CPM Postman collection is a straightforward way to start working with the Consent State API. By setting up the environment and collection in Postman, you can easily test and understand the API endpoints, helping you to create custom consent capture points with full control over the rendering and submission of data.