The Predictive Intelligence API provides endpoints that predict a field value based on one or more input fields and a trained solution.

You can only use this API when the Predictive Intelligence (com.glide.platform_ml) plugin is activated.

Predictive Intelligence - GET /agent_intelligence/solution/{solution_name}/prediction

Predicts an output field value using a specific solution.

URL format

Default URL: /api/now/agent_intelligence/solution/{solution_name}/prediction

Supported request parameters

Table 1. Path parameters
Name Description
solution_name Name of solution to use for predictions. For example, ml_incident_categorization.

Data type: String

Table 2. Query parameters
Name Description
Solution definition input field key-value pair Name-value pair of the solution input field. For example, enter the name: short_description and the value: Unable to connect to VPN.

Data type: String

Table 3. Request body parameters (XML or JSON)
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 4. Request headers
Header Description
Accept Data format of the response body. Supported types: application/json or application/xml.

Default: application/json

Table 5. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 6. Status codes
Status code Description
200 Successful. The request was successfully processed.
401 Unauthorized. The user credentials are incorrect or have not been passed.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters (JSON or XML)

Example: Sample cURL request

curl "https://instance.service-now.com/api/now/predictive_intelligence/solution/ml_incident_categorization/prediction?short_description=unable%20to%20connect%20to%20VPN" \
--request GET \
--header "Accept:application/json" \
--user "username":"password"
{
  "result": {
    "input": {
      "short_description": "unable to connect to VPN",
      "api": "api"
    },
    "output": {
      "outcome": "inquiry",
      "confidence": 53.84615375762915,
      "threshold": 5
    }
  }
}

Predictive Intelligence - GET /agent_intelligence/solution/prediction

Returns predictions for multiple solutions.

Note: Outcome result objects are grouped by solution name and sys_id in the format result.<solutionname>.<sys_id>.[{ <result1> },{ <result2>}].

For customization information, see MLSolutionFactory scriptable objects.

URL format

Versioned URL: /now/{api_version}/agent_intelligence/solution/prediction

Default URL: /now/agent_intelligence/solution/prediction

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 7. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 9. Request body parameters (XML or JSON)
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 10. Request headers
Header Description
Accept Data format of the response body. Supported types: application/json or application/xml.

Default: application/json

Table 11. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Response body parameters (JSON or XML)

Example: Sample cURL request

curl "http://instance.servicenow.com/api/now/agent_intelligence/solution/prediction?input_table=incident&input_filter=sys_id%3D0ef47232db801300864adfea5e961912&solution_names=ml_incident_categorization%2Cml_incident_assignment&options=%7B%22top_n%22%20%3A%202%2C%20%22apply_threshold%22%3Afalse%7D" \
--request GET \
--header "Accept:application/json" \
--user "username":"password"
{
  "result": {
    "ml_incident_categorization": {
      "0ef47232db801300864adfea5e961912": [
        {
          "confidence": 29.12211732875455,
          "threshold": 15,
          "predictedValue": "Email",
          "predictedSysId": ""
        },
        {
          "confidence": 19.08583525847071,
          "threshold": 14,
          "predictedValue": "Platform Performance",
          "predictedSysId": ""
        }
      ]
    },
    "ml_incident_assignment": {
      "0ef47232db801300864adfea5e961912": [
        {
          "confidence": 5.782322543467415,
          "threshold": 5,
          "predictedValue": "IT Finance CAB",
          "predictedSysId": "5f63e48fc0a8010e00eeaad81cd4dd37"
        },
        {
          "confidence": 5.303589009246953,
          "threshold": -1,
          "predictedValue": "NY DB",
          "predictedSysId": "5f74727dc0a8010e01efe33a251993f9"
        }
      ]
    }
  }
}