APEX API – Data Portability – Cloud Compliance

Updated on March 20, 2023

The Data Portability feature of Cloud Compliance – GDPR Data Management generates files that include personal data. 

In the use cases where the Data Portability feature needs to be invoked by an external system, Cloud Compliance offers an APEX API interface.

This document explains how to invoke a mapping that is pre-configured via APEX API using a JSON-based callout. The API auto-creates a case and generates the JSON file.

The two different methods that are available for this API are:-

PCCC_DM.DataPortaibiltyRestServiceV1.createPortibilityRequest(Record_ID, Mapping Name)

This method takes two parameters. Record_ID being the Parent object while the  Mapping Name is the name of the mapping defined under Implement > Data Portability Mappings.
 

PCCC_DM.DataPortaibiltyRestServiceV1.getCaseStatus(ID)

This method takes a single parameter. ID is the Parent object.

Solution Steps

1. Navigate to a Salesforce record (A Contact object in this example)

2. Copy the Record Id of the contact from the URL. An id is highlighted in the URL for reference in the screenshot below.

3. Navigate to the Cloud Compliance > Implement > Data Portability section. This will open the list of Portability mappings.
 

4. Copy the name of the mapping (In this example, Contact Mapping is the mapping name). In the case of this example mapping, Contact is the Parent object.
 

5. Open the Salesforce Developer Console.
 

6. Prepare the createPortibilityRequest method. 

Map < String, Object > res = PCCC_DM.DataPortaibiltyRestServiceV1.createPortibilityRequest(‘003W000000vEdM8’,
‘Contact Mapping’);
System.debug(‘Res:’ + res);


7. This API returns a Case Id and a Status (success/failed) message. An example of a Status message is given below

caseId=500W000000Iv01IAA

hasError: false

8. Cop the case ID. 
 

9. Pass the Case Id as the parameter of getCaseStatus(). This API would return a JSON.

Map < String, Object > res = PCCC_DM.DataPortaibiltyRestServiceV1.getCaseStatus(‘500W0000004lv01IAA’);
System.debug(‘Res:’ + res);

10. Click the Execute button to invoke the Apex API and use Debug Only to validate the JSON.

11. Navigate to the case in Salesforce to validate the file generated by the Apex API call.