Query Prediction History

The Einstein Prediction Service provides a REST API endpoint to query prediction histories.

Predict History Request

POST ​/smartdatadiscovery​/predict-history

POST Request Body

Use the Predict History Input to create your request body.

In the request body, you specify the ID of the goal, the prediction history range, and a list of targets.

Format Description
goalId The ID of the prediction definition to query for historical predictions.
targets A list of opportunity IDs as strings to use for the target entities of the query. The list is limited to 1 entry.
range An optional range for the query. Use the Predict History Range Input to specify the range. The range includes:
  • maxLookBack an optional value to specify the number of prediction history values. 1-3 are the valid values, with a default value of 1.
  • interval an optional value to specify the prediction history interval. Valid values are Weekly or None, with a default value of Weekly.

Query prediction history with a maxLookBack of 2

Query the prediction history using the following API request:

POST ​/smartdatadiscovery​/predict-history

Request body:

{
    "targets" : [ "1Otxx00000000304AA" ],
    "goalId" : "1ORxx00000000509BA",
    "range" : {
        "maxLookBack" : 2 
     }
}

POST Response Body

The POST response is a Predict History Collection.

Response body:

{
    "history" : [
        {
            "target" : "006xx000001a2p3AAA",
            "predictions" : [
                {
                    "createdDate" : "2022-09-16T19:47:14.000Z",
                    "value" : "21.69962721629",
                    "model" { "id" : "1Otxx00000000304AA" }
                },
                {
                    "createdDate" : "2022-09-16T19:47:15.000Z",
                    "value" : "21.83126271983",
                    "model" { "id" : "1Otxx00000000304AA" }
                }
            ]
        }
    ],
    "range" : {
        "maxLookBack" : 2,
        "interval" : "Weekly"
    }
}