Call the Data Job API

Quick example of how to call the Data Job API.

To call the API, you must have already completed the other tasks in the Quick Start.


User Permissions Needed
To use the Developer Console: API Enabled AND View All Data
To view, retain, and delete debug logs: View All Data
To execute anonymous Apex: Author Apex
To use code search and run SOQL or SOSL on the query tab: API Enabled
To save changes to Apex classes and triggers: Author Apex
To save changes to Visualforce pages and components: Customize Application
To save changes to Lightning resources: Customize Application
To access the Customer 360 Data Manager org System Administrator

You can use any tool of your choice to call the API. The code examples in this guide use a command-line tool called cURL to simplify sending and receiving HTTP requests and responses.

cURL is pre-installed on many Linux and Mac systems. Windows users can download a version at curl.haxx.se/. When using HTTPS on Windows, ensure that your system meets the cURL requirements for SSL.

The Base URI includes the API Gateway FQDN and the product domain. The API Gateway FQDN depends on the region of the Customer 360 Data Manager org.
Table 1. Regional FQDN
Region Base URI
North America na.api-salesforce.com
Europe eu.api-salesforce.com
Asia/Pacific ap.api-salesforce.com

The required domain for the Data Jobs API is datamanager.

Example: URL for the Jobs resource
1https://na.api-salesforce.com/datamanager/datatools/v1.0/jobs
  1. Open your command line.
  2. To retrieve an access token, make an authentication call. Use the Customer 360 Data Manager org name as the instance_url. If you’re developing an app, the connected app provides this access token, this call is only necessary for the examples that use cURL.
    • login_url: use the URL you use to log in to Salesforce.
    • client_id: use the connected app consumer key.
    • client_secret: use the connected app consumer secret.
    • username: use the username you use to log in to Salesforce.
    • password: use the password you use to log in to Salesforce.
    1curl -k https://instance_url.salesforce.com/services/oauth2/token \
    2-d "grant_type=password" \
    3-d "client_id= 3MVG9qKMKuRGRcbuZ90BMXK_bF3MizRStXIw1gC7iPmpDmw5ScBvbCyZXJ7R2urNDRcwB3I7m9pt9qgd5ogMN" \
    4-d "client_secret= F490545988E166F17B0A7317068FB2ED71E913FBF0C1F24A732E8BB9FC82ACED" \
    5-d "username=admin@myapps.com" \
    6-d "password=test4mB1riuD3n"
    This result is an example:
    1{
    2	"access_token": "00DRM000000IeI2!AR4AQIJeeDdSm1eibRjSGn_qe4XOFG4_MUrRAo2RhA9WXWsQtWzRTxaAOdpwUYj7L21hqvI6lknfHc5Ua4Drf.GudSR82UXN",
    3	"instance_url": "https://shadow-org.my.salesforce.com",
    4	"id": "https://login.stmfb.stm.salesforce.com/id/00DRM000000IeI22AK/005RM000001yVhvYAE",
    5	"token_type": "Bearer",
    6	"issued_at": "1594662156814",
    7	"signature": "Xik2Lq7n/1+F1S+aHF8kS7AeNQaQdLkRPG1pvsSP+8U="
    8}

    The information in the token is required for calls to the DJ API.

    Note

  3. Use one of the resources of the API. You need information for the headers, URI parameters, and authentication token. The x-sfdc-domain header value is derived from the instance_url returned in the authentication token.
    1curl -vL -X GET \
    2  https://na.api-salesforce.com/datamanager/datatools/v1.0/data-sources \
    3  -H 'accept: application/json' \
    4  -H 'authorization: Bearer 00DRM000000IeI2!AR4AQIJeeDdSm1eibRjSGn_qe4XOFG4_MUrRAo2RhA9WXWsQtWzRTxaAOdpwUYj7L21hqvI6lknfHc5Ua4Drf.GudSR82UXN' \
    5  -H 'x-sfdc-domain: shadow-org.my.salesforce.com'
    This result is an example:
    1[
    2  {
    3    "domain": "svc1597507920996",
    4    "id": "core/stmfbna44ice1/00DRM000000Iw7n2AC",
    5    "name": "Service Org 2",
    6    "type": "Core"
    7  },
    8  {
    9    "domain": "svc1597507895985",
    10    "id": "core/stmfbna44ice1/00DRM000000Iw7i2AC",
    11    "name": "Service Org 1",
    12    "type": "Core"
    13  },
    14  {
    15    "domain": "stmfbna44ice1",
    16    "id": "cre/stmfbna44ice1/creprd000003sej",
    17    "name": "cre-creprd000003sej",
    18    "type": "CRE"
    19  }
    20]