Exporting CRM Data Validation

Overview

The Sales Navigator Data Validation API performs validation of data ingested via CRM Sync and returns an export for a CRM instance that identifies contact and lead records whose current company on LinkedIn does not match the company in the CRM.

The API allows bulk export of the validated records through asynchronous jobs that a caller must create, poll for completion, and retrieve the results once completed.

To get started with CRM Data Validation API, please check out Getting Started before continue with this tutorial.

Create an Export Job

Export jobs are created via POST by specifying the external CRM instance ID you want to create an export for, in the form of a URL-encoded CRM instance URN.

To create an data validation export job that flag records expired from 11/9/2018 till now with /crmDataValidationExportJobs endpoint:

POST https://api.linkedin.com/v2/crmDataValidationExportJobs?crmInstanceId={crmInstanceId} HTTP/1.1
Authorization: Bearer {ACCESS_TOKEN}
x-restli-protocol-version: 2.0.0
Content-Type: application/json

{"exportStartAt":1533772800000}

Successful job creation responses will have a 201 Created status code and contain the job ID in the x-restli-id header. There will be no response body:

HTTP/1.1 201 Created
Location: /crmDataValidationExportJobs/148
X-RestLi-Id: 148
X-RestLi-Protocol-Version: 2.0.0
Date: Tue, 06 Nov 2018 21:19:13 GMT

Query Export Job Status

Once an export job is created it will run asynchronously. Processing could take up to two hours. You can request the status of your query to check if it has been marked as COMPLETED. Once the job completes, and the status displays completed, you will be provided a short lived download URL in the downloadURL field which can be used to retrieve the data.

To query an export job with /crmDataValidationExportJobs endpoint:

GET https://api.linkedin.com/v2/crmDataValidationExportJobs/{jobId}?crmInstanceId={crmInstanceId} HTTP/1.1
Authorization: Bearer {ACCESS TOKEN}
x-restli-protocol-version: 2.0.0

Completed jobs will have downloadUrls in the response, in case when the export is too big in fize size, it will have multiple downloadUrls in the downloadUrls array.

Sample Response (Job completed):

{
  "jobId": 148,
  "exportStartAt": 1538947151337,
  "exportEndAt": 1541539151570,
  "downloadUrls": ["https://www.linkedin.com/ambry/?x-li-ambry-ep=AQFVMzGy8qJVMQAAAWbwbeHrHZG5mJkIDr2xq_Z3znIfOzp1FvApV-oL3Jd0ck"],
  "nextExportStartAt": 1538947151337,
  "expireAt": 1541635625000,
  "status": "COMPLETED"
}

Note

A job ID will not expire for at least a week.

Download the Export

Once data is ready to download, you can download the CSV file from the downloadUrls provided. As with all other endpoints, access tokens must be sent in the Authorization header of the GET request.

To download the export:

GET {downloadUrl} HTTP/1.1
Authorization: Bearer {ACCESS_TOKEN}
x-restli-protocol-version: 2.0.0

Note

  1. The CSV file will be returned as a stream
  2. The short lived downloadUrls are only valid for 1 hour, and new downloadUrls may be returned upon expiry

CSV Export Schema

The export file is in CSV format. The schema can be found in below table.

Column Name Data Type Optional in response? Description
crmId string false Unique ID for the record in the CRM
crmRecordType string false Type of record. Valid record type: CONTACT
expiredAt long false The time at which the export was started from
createdAt long false The time for the end bound of the export