REST API – Data Portability – Cloud Compliance

Updated on November 14, 2023

Generate portability files that include personal data using ‘Cloud Compliance – GDPR/CCPA Management Suite’  

For integration use cases where Portability needs to be invoked from an external system, Cloud Compliance offers a REST API interface.

This note explains how to invoke a pre-configured portability mapping via REST API using a JSON based callout.

Capabilities

  • REST API based de-identification
  • JSON format support for parameters
  • REST API auto-creates a case and generates PDF, CSV and JSON files

There are 2 REST API’s that are developed for this requirement:

1.  POST Request:

/services/apexrest/PCCC_DM/v1/PortabilityRestService

Body 

{ “sourceRecordId”: “ID”,”dataPortabilityMapName”: “MAP_NAME”}
  

2. GET

/services/apexrest/PCCC_DM/v1/PortabilityRestService? caseId=ID
    

Solution Steps

1. Navigate -> Salesforce record (Contact record in this example).

2. Copy the record Id from the URL (‘003f400001FNtPS’ in this example).

3. Navigate -> Cloud Compliance UI and open the Portability mapping.

4. Copy the name of the Portability mapping (“Account Portability” in this example).
 

5. Navigate -> REST tool such as Salesforce’s developer workbench, Postman, Insomnia, etc. (This example uses Salesforce Developer Workbench) 


6. Navigate -> ‘REST Explorer’ utility within the workbench and select the “POST” method.

7. For the “POST” method, enter the Cloud Compliance’s Apex URL.

/services/apexrest/PCCC_DM/v1/PortabilityRestService

8. Paste the Record Id and Mapping Name with the following JSON format in the request body.
 

{ “sourceRecordId”: “0030b00002TTaijAAD”,”dataPortabilityMapName”: “Account Portability”}

9. Click the “Execute” button to invoke the REST API


10. The REST API returns a case id and a success message(hasError: false).



11. Use the 2nd REST API to get the Portability JSON using the Case ID.

/services/apexrest/PCCC_DM/v1/PortabilityRestService? caseId=5000b00001dlZv7AAE


12. Click on Execute and it should fetch the portability JSON. 

Raw Response – 

HTTP/1.1 200 OK Date: Fri, 03 Jul 2020 04:53:18 GMT Strict-Transport-Security: max-age=31536002; includeSubDomains Public-Key-Pins-Report-Only: pin-sha256=”9n0izTnSRF+W4W4JTq51avSXkWhQB8duS2bxVLfzXsY=”; pin-sha256=”5kJvNEMw0KjrCAu7eXY5HZdvyCS13BbA0VJG1RSP91w=”; pin-sha256=”njN4rRG+22dNXAi+yb8e3UMypgzPUPHlv4+foULwl1g=”; max-age=86400; includeSubDomains; report-uri=”https://a.forcesslreports.com/hpkp-report/00D0b000000BaDWm”“; Expect-CT: max-age=86400, report-uri=”https://a.forcesslreports.com/Expect-CT-report/00D0b000000BaDWm”” X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block X-Robots-Tag: none Cache-Control: no-cache,must-revalidate,max-age=0,no-store,private Set-Cookie: BrowserId=HRXH8bzpEeqzxQthUUajFw; domain=.salesforce.com; path=/; expires=Sat, 03-Jul-2021 04:53:18 GMT; Max-Age=31536000 Content-Type: application/octetstream Transfer-Encoding: chunked


Here is the complete JSON for reference:

{“JsonBody”:”[ {\n \”recordList\” : [ [ {\n \”value\” : \”Bezants\”,\n \”label\” : \”Last Name\”\n }, {\n \”value\” : \”Joyous\”,\n \”label\” : \”First Name\”\n }, {\n \”value\” : \”bezants@gmail.com\”,\n \”label\” : \”Email\”\n }, {\n \”value\” : \”1985-07-10 00:00:00\”,\n \”label\” : \”Birthdate\”\n }, {\n \”value\” : \”720-986-3628\”,\n \”label\” : \”Mobile Number\”\n }, {\n \”value\” : \”251-597-4218\”,\n \”label\” : \”Home Phone\”\n }, {\n \”value\” : \”Engineering\”,\n \”label\” : \”Department\”\n }, {\n \”value\” : \”Research Associate\”,\n \”label\” : \”Title\”\n }, {\n \”value\” : \”Springfield\”,\n \”label\” : \”Mailing City\”\n }, {\n \”value\” : \”Illinois\”,\n \”label\” : \”Mailing State\”\n }, {\n \”value\” : \”United States\”,\n \”label\” : \”Mailing Country\”\n }, {\n \”value\” : \”Sunbrook\”,\n \”label\” : \”Mailing Street\”\n }, {\n \”value\” : \”62764\”,\n \”label\” : \”Mailing Zip/Postal Code\”\n }, {\n \”value\” : \”651-208-9200\”,\n \”label\” : \”Asst. Phone\”\n }, {\n \”value\” : \”937-338-5442\”,\n \”label\” : \”Business Phone\”\n }, {\n \”value\” : \”713-568-2132\”,\n \”label\” : \”Other Phone\”\n } ] ],\n \”objName\” : \”Contact\”,\n \”objId\” : \”0030b00002TTaijAAD\”\n}, {\n \”recordList\” : [ [ {\n \”value\” : \”TXN-000003\”,\n \”label\” : \”Transaction Id\”\n }, {\n \”value\” : \”3000\”,\n \”label\” : \”Amount\”\n }, {\n \”value\” : \”2020-07-15 00:00:00\”,\n \”label\” : \”Date\”\n }, {\n \”value\” : \”Credit\”,\n \”label\” : \”Transaction Type\”\n }, {\n \”value\” : \”4444333366664321\”,\n \”label\” : \”Credit Card Number\”\n }, {\n \”value\” : \”2020-07-29 00:00:00\”,\n \”label\” : \”Credit Card Expiration Date\”\n } ] ],\n \”objName\” : \”Transaction\”,\n \”objId\” : \”a0i0b0000075zVvAAI\”\n}, {\n \”recordList\” : [ [ {\n \”value\” : \”Laptops I5\”,\n \”label\” : \”Asset Name\”\n }, {\n \”value\” : \”Purchased\”,\n \”label\” : \”Status\”\n }, {\n \”value\” : \”5000\”,\n \”label\” : \”Price\”\n }, {\n \”value\” : \”1000.00\”,\n \”label\” : \”Quantity\”\n }, {\n \”value\” : \”2020-07-08 00:00:00\”,\n \”label\” : \”Purchase Date\”\n }, {\n \”value\” : \”2020-07-15 00:00:00\”,\n \”label\” : \”Install Date\”\n }, {\n \”value\” : \”LT-444\”,\n \”label\” : \”Serial Number\”\n } ] ],\n \”objName\” : \”Asset\”,\n \”objId\” : \”02i0b000013D2ZfAAK\”\n} ]”,”hasError”:false}


13. Navigate -> Cases in Salesforce to validate that portability extracts are there.