Skip to main content

InCountry REST API to get record statistics

Table of сontents

You can use the InCountry REST API to retrieve the record statistics about the Salesforce objects. For example, you can find how many regulated records of the Account type are stored on the InCountry platform.



The *.JKS certificate that is currently used for the operation of the InCountry Data Residency package will not be appropriate for this operation.

  1. You need to acquire the .CRT and .KEY certificate files from the InCountry team for your production or sandbox instances. If you do not already have these two files, please request them from the InCountry team.

  2. Postman is installed on your desktop.


Please be careful when sharing your InCountry production certificates. These certificates grant full read/write access to your data records stored on the InCountry platform.

Retrieving record statistics

  1. Open Postman.

  2. Copy this link to the Postman collection to your clipboard:

  3. On the menu, select File, then click Import.

    Postman application menu

  4. In the Import form, select the Links tab.

  5. In the Enter a URL box, paste your link to the Postman collection.

    Postman - Import form

  6. Click Continue, then click Import.

    Postman - Collection importing

  7. The imported collection appears in the Collections section.

    Postman - InCountry collection

  8. Select the imported collection and switch to the Variables tab.

    Postman - InCountry collection

  9. Copy the InCountry Rest API endpoint to the clipboard. You can find out your current REST API endpoint in the Salesforce org where the InCountry Data Residency package is installed. Then navigate to Setup > Custom Metadata Types > InCountryRestApiEndpoint > Manage Records > [country code].

  10. Paste your endpoint into the endpoint environment variable and save the collection.

    Postman - Variables

  11. Ensure that other variables are set as follows:

    1. requestNumber=1
    2. offset=0
    3. limit=100
    4. totalRecords=1

    Postman - Variable values

  12. Navigate to Settings.

    Postman - Settings menu

  13. In the Settings form, select the Certificates tab.

  14. In the Host box, paste your endpoint address.

    Postman - Certificates

  15. Add the imported InCountry Rest API certificates. Click Select File and select your .CRT and .KEY certificate files in the corresponding boxes.

  16. Save the certificate and close the Settings form.

  17. Within the collection, locate and select the Find records request.

    Postman - Find records request

  18. Within the opened request, switch to the Body tab.

  19. Within the request body, locate the country parameter and correct it to the ISO code of the country where regulated data records are stored.

    Postman - Request body

  20. Switch to the Tests tab. There you can find a JavaScript script that aggregates information about data records stored on the InCountry platform in a particular country. You can modify this script depending on your needs.

    Postman - Request body

  21. On the menu, select View, then click Show Postman Console. After the script execution, results will be outputted to the Postman console.

    Postman - Show Postman console

  22. To capture the information, open the collection and click Run. The Runner tab opens.

    Postman - Runner tab

  23. On the Runner tab, click Run InCountry Rest API.

    Postman - Run InCountry REST API

  24. In the Postman console, you will see the debug information about requests to the InCountry Rest API.

    Postman - Console output

  25. Once the script execution has been completed, you will see the aggregated results on the Environment tab. The Variable name represents the Salesforce object type. For example, 001 is a Salesforce Account (4147 Accounts are stored on the InCountry platform according to the image below). You can find the prefixes for standard Salesforce objects at this resource (actually it always includes the first 3 characters of your record Id).

    Postman - Output results

  26. You can modify the script to print additional information about your data records. For example, lines 28-30 in the screenshot below print identifiers of regulated Account records to the Postman console.

    if (prefix === '001') {
    console.log('Regulated account Id = ' + record.profile_key);

    Postman - JS script

  27. You will see the output in the Postman console.

    Postman - console with record ids

  28. If necessary, you can export the output results to a file. Click Export results.

    Postman - Export Results