Dela via


Exporting User Activity

Overview

Analytics Services allows the export of activities performed by seat holders, outcomes of those activities, and the export of summarized statistics and metadata about seat holders. In this tutorial you will learn how to export Sales Navigator data.

The export process is asynchronous, and allows for export of specific data types over user-defined intervals. A successful export requires the creation of a job, getting the status of the job to determine if the job has completed, and once it has completed, retrieving the export from a download URL.

Important

Exports can only be performed by Sales Navigator users with reporting or administrator roles assigned. Users must be assigned these roles on each contract they wish to export. Exports can only be performed on Advanced and Advanced Plus contracts.

Get Contracts

All export jobs are created in the context of a contract. A LinkedIn member can have a seat on one or multiple contracts, so it is necessary to build a contract chooser to enable the user to select the contracts for which they want to export data. Only contracts users have reporting access to will be available for users to export data from, and the reporting access can be determined by hasReportingAccess field for the contracts.

You can get a list of contracts from the /salesContracts endpoint:

GET https://api.linkedin.com/v2/salesContracts?q=contractsByMember HTTP/1.1
Authorization: Bearer {ACCESS_TOKEN}
X-Restli-Protocol-Version: 2.0.0

Create an Export Job

Export jobs are created via POST to the /salesAnalyticsExportJobs endpoint by specifying the type of data you want to export in the action query parameter and by specifying interval and contract details in the POST body. We support following types of export actions:

  • exportActivityData: Returns activities performed by seat holders, e.g. saving leads, performing searches, and sending InMail.
  • exportSeatData: Returns data about seat holders, e.g. seat holder name, seat status, Social Selling Index scores, total connections.
  • exportActivityOutcomeData: Returns results of performed activities.

If a job creation request is successful, you will receive the job ID for the export in the response.

To create an activity export job with /salesAnalyticsExportJobs endpoint:

POST https://api.linkedin.com/v2/salesAnalyticsExportJobs?action=exportActivityData HTTP/1.1
Authorization: Bearer {ACCESS_TOKEN}
X-Restli-Protocol-Version: 2.0.0
Content-Type: application/json

{"startAt":1538432171000,"endAt":1538518571000,"contract":"urn:li:contract:{contractUrn}"}

Query Export Job Status

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

To query an export job status with /salesAnalyticsExportJobs endpoint:

GET https://api.linkedin.com/v2/salesAnalyticsExportJobs/{jobId}?contract={contractUrn} HTTP/1.1
Authorization: Bearer {ACCESS_TOKEN}
X-Restli-Protocol-Version: 2.0.0

Download the Export

Once a job is completed and the export is ready to download, you can download the CSV file from the downloadUrl. As with all other endpoints, access tokens must be sent in the Authorization header of the GET request. To understand the CSV schema, see Exports Schema.

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 downloadUrl is only valid for 3 hours. We will respond the request with 401 status code after the URL expires. You may request a new downloadUrl by querying the job status again.