REST API – Consent Retrieval – Cloud Compliance

Users can use this REST API to retrieve the latest consent by passing Individual Id. Cloud Compliance’s Grouping Rules of Individual will associate each and every contact or lead record with an Individual. 

All the consent management is implemented around Individual objects. Hence just by passing the Individual Id or list of Individual Ids to the Consent Retrieval API, the user can fetch the latest consents associated with that Individual.

The GET method used for Consent Retrieval is as follows.
 

URL:-  For GET Method

/services/apexrest / PCCC_DM / v1 / ConsentRestAPI


Request Body:- 

{
    "IndividualIdList": ["INDIVIDUAL_ID"]
}


Note:- User can use this REST API for multiple individual Ids by comma-separated value and can fetch consents are as follows –

For Example:-  

{
    "IndividualIdList": ["0PK5g000000k9kGGAQ", "0PKB00000000EGyOAM",
        "0PKB00000000pVyPLM", "0PKB00000000RTyOYM"
    ]
}


Solution Steps

1. Navigate to a Salesforce Contact/Lead record for which users want to fetch the latest consent record via REST API. Here contact record is used as a sample. This contact record contains 3 consents (Contact Point Type Consent Records) – SALES -SMS as Opt-In, MARKETING – SOCIAL as Opt-Out, and SALES – PHONE as Opt-In.


2. This contact record is associated with the Individual Record.  


3. Go to the Individual record and get the Individual record Id from the URL. The Id is highlighted for reference in the screenshot:-


4. Navigate to a REST tool such as Postman. Users can use the web as well as the desktop version of Postman.

Note – This example uses the Postman only. 

For more information on Postman please refer to – 

https://www.postman.com/product/workspaces/


5. Open the Postman. Prepare the GET method by passing the Individual Id as parameters and execute the code.

Add a Tab and select the “GET” method and paste the URL.

/services/apexrest / PCCC_DM / v1 / ConsentRestAPI



6. In the Body Section paste Request Body

Copy the Individual Record Id with the following raw format in the Body

{
"IndividualIdList": ["0PK5g000000k9kGGAQ"]
}


7. Click the “Send” button to invoke the REST API.


8. This API returns Consent records related to a Contact record. Here the three consent fetches are highlighted in screenshots. The one is Opt-Out, the Second one is Opt-In and another is Opt-In. These details can be used for further operations to integrate with other systems. Users can also get these types of results for multiple individual Ids by passing individual record Ids separating by a comma.