Introduction to the Scoring API's Functionality
The scoring request supports multiple input events and multiple output events. The JSON code for the request encloses all inputs and outputs in an array.
Here is an example request:
curl -X POST http://myserver:1234/eventStreamProcessing/v2/score --data-binary @input.json
Information relevant to the Scoring API is
added to the project's XML code, using the following attributes of the
project element.
score-input-windowscore-input-fieldscore-output-windowscore-output-field
For more information about these attributes, see project in SAS Event Stream Processing: XML Language Reference for Event Stream Processing Models.
You can use SAS Event Stream Processing Studio to set the project-level attributes. For more information, see Update Project Properties in SAS Event Stream Processing: Using SAS Event Stream Processing Studio.
You can use the test mode in SAS Event Stream Processing Studio to send requests and receive responses. For more information, see Use the Scoring API When Testing a Model in SAS Event Stream Processing: Using SAS Event Stream Processing Studio.
The score request depends on one or more input events generating one or more output events. If the output events are not seen by the ESP server in a certain amount of time, the request times out and sends back a 500 response code (server error). Here is an example:
$ curl -w "response code is %{http_code}\n" "http://myserver:2222/eventStreamProcessing/v2/score" --data-binary @claim_2.xml
Score request timed out after 20 seconds.
response code is 500
The time-out defaults to 20 seconds, but it can be configured in the esp-properties.yml file. Here is an example:
server:
score_timeout: 30 # Timeout, in seconds, for Scoring API requests