Overview
This document provides prerequisites and API usage examples for building custom applications using real-time scoring and enrich REST APIs.
Note: APIs have scheduled maintenance for one hour every other week.
API Rate limiting / Thresholds
Standard quota limit for Score / Enrichment API calls is 1000/hour and 25000/day.
We highly recommend reviewing your application logic for calling APIs and ensuring users aware of the expected volume of daily API calls.
Prerequisites
The following should be true in order to use the APIs.
- You have a login to the CDP
- You have created the models and enabled them for scoring in your tenants.
- You have configured Data Cloud attributes for enrichment.
- You have created One-Time-Password using "Generate Salesforce Access Token"
Authenticate your application with the CDP
-
Create One-Time-Password using "Generate Salesforce Access Token"
-
Use the Authentication Rest API to authenticate your application with the CDP.
As part of the authentication response, Access token and Refresh token will be provided. Use these two token with all API calls. The refresh token is valid for six months.
Authenticate API Request
Note: "app_id" is a client-generated string, which uniquely identifies the customer application. So that, when the API is used at a different application from the same customer, it will not impact the access_token of prior applications. Ex: app_id=web.company.salesapp1
curl --user "lp:" https://oauth.lattice-engines.com/oauth/token -d grant_type=password -d username=<tenantID.tenantID.Production> -d app_id=<hosting>.<tenantID>.<application> -d password=<OTP>
Authenticate API Response
{"access_token":"a8a7a1c3-de25-4530-9642-5ceb4f71bbcd","token_type":"bearer","refresh_token":"7a2aa402-2b1a-4ee0-a213-cab9af57bde3","expires_in":43199,"scope":"read write"}
Refresh Access Token API Request
curl --user "lp:" https://oauth.lattice-engines.com/oauth/token -d grant_type=refresh_token -d username=<tenantid.tenantid.production> -d app_id=<hosting>.<tenantid>.<application> -d refresh_token=<7a2aa402-2b1a-4ee0-a213-cab9af57bde3></application></tenantid></hosting></tenantid.tenantid.production>
Refresh Access Token API Response
{"access_token":"f132b3c4-57f6-4708-b48b-17ee82281a4a","token_type":"bearer","refresh_token":"7a2aa402-2b1a-4ee0-a213-cab9af57bde3","expires_in":43199,"scope":"read write"}
Get Model Details
Get model details, which will provide Field Mapping and its input validation expression for required mapping fields.
We Recommend providing data for all Primary Fields when sending a Scoring / Enrichment request
Request
curl -X GET -H "Authorization: Bearer f132b3c4-57f6-4708-b48b-17ee82281a4a" "https://apigw.lattice-engines.com/score/v01/modeldetails?considerAllStatus=true&offset=0&maximum=4"
Response
[ { "model": { "modelId": "ms__7767be0b-1a6e-406e-aef9-85d633571481", "name": "DBFinal", "type": "CONTACT" }, "status": "Active", "fields": { "modelId": "ms__7767be0b-1a6e-406e-aef9-85d633571481", "fields": [ { "fieldName": "Email", "fieldType": "STRING", "displayName": "Email", "isRequiredForScoring": true, "isPrimary": true }, { "fieldName": "Id", "fieldType": "STRING", "displayName": "Id", "isRequiredForScoring": true, "isPrimary": true } ] }, "lastModifiedTimestamp": "2016-09-01T20:53:37+0000" }, { "model": { "modelId": "ms__a7507c99-5d3e-47bc-9527-fca12059bab3", "name": "EnterpriseMajors", "type": "ACCOUNT" }, "status": "Active", "fields": { "modelId": "ms__a7507c99-5d3e-47bc-9527-fca12059bab3", "fields": [ { "fieldName": "Website", "fieldType": "STRING", "displayName": "Website", "isRequiredForScoring": true, "isPrimary": true }, { "fieldName": "Country", "fieldType": "STRING", "displayName": "Country", "isRequiredForScoring": false, "isPrimary": true }, { "fieldName": "Id", "fieldType": "STRING", "displayName": "Id", "isRequiredForScoring": true, "isPrimary": true } ] }, "lastModifiedTimestamp": "2017-01-26T22:12:28+0000" } ]
Detailed list of API's with swagger documentation is available as Attachment.
Comments
0 comments
Please sign in to leave a comment.