Skip to content

HTTP API Reference

Dan M edited this page Jun 29, 2016 · 9 revisions

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

Contexts

Request type: POST

URL:

    https://{base}/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.

Rerequired headers:

    auth: {password}

Body:

Should be a JSON encoded context, 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}

Required headers:

    auth: {password}

Body:

A single floating-point number and nothing else.

Clone this wiki locally