Skip to content

HTTP API Reference

Markus Cozowicz edited this page Jul 25, 2016 · 9 revisions

For a less terse introduction to the Front-end HTTP API, see the Tutorial.

Implementation can be found here.

Contexts

Request type: POST

URL:

    https://{management center url}/API/{decType}

where decType is a decision type. The 2 possible decision types are 'Ranker' and 'Policy'.
If the decision type is 'Ranker', then the body is expected to have _multi features, and the return type is an array of ints. If the decision type is 'Policy', then the body is expected to NOT have _multi features, and the return type is a single int.

Required headers:

    auth: {web service token}

Body:

Should be a JSON encoded context (see reference), with feature/value pairs, as in

           { 
            "Age": 25, 
            "Location": "New York",
            "_multi": 
                [
                    { "Topic": 1}, 
                    { "Topic": 2}
                ]
            }

_multi: indicates action-dependent features, with each array element corresponding to one action.
The features before _multi are shared across all actions. If the decision type (see above) is 'Policy', then there should NOT be a _multi field. 'Policy' decision types with _multi features are currently not supported.

Decisions

Decisions come back as the response to the context POST, along with an event ID, in a format that looks like this:

{
    "Action":  [3,1,2,4],
    "EventId": "dd3rd8adf83kadf"
}

If the decision type is 'Policy', then the Action will be a single integer instead of an array.

Rewards

Request type: POST

URL:

    https://{base}/API/Reward/?eventId={eventID}

Required headers:

    auth: {web service token}

Body:

A single floating-point number and nothing else. In general the system allows to ingest arbitrary reward, but users have to adapt the Azure Stream Analytics Join Query. As an example one could send reward strings (e.g. "click") and use Azure Stream Analytics (ASA) SQL to map it to a float.

Clone this wiki locally