Endpoints

GET | POST /recommendations

Get num_recs recommendations from the default configured algorithm for the user_id sent.

Example requests:

GET /recommendations/?user_id=1&num_recs=5
Host: example.com
Accept: application/json, text/javascript
Content-Length: 20
POST /recommendations
Host: example.com
Accept: application/json, text/javascript
Content-Length: 26

Data: { "user_id" : 1, "num_recs" : 5 }

Example response:

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 178

{
"recommendations": [
        {
            "item": 356.0,
            "score": 341.0
        },
        {
            "item": 296.0,
            "score": 324.0
        },
        {
            "item": 318.0,
            "score": 311.0
        },
        {
            "item": 593.0,
            "score": 304.0
        },
        {
            "item": 260.0,
            "score": 291.0
        }
    ]
}
Query Parameters
  • user_id (int) – user id to get recommendations for

  • num_recs (int) – number of recommendations to return

JSON Parameters
  • user_id (int) – user id to get recommendations for.

  • num_recs (int) – number of recommendations to return.

GET | POST /algorithms/(string: algo)/recommendations

Get num_recs recommendations using the algorithm and user_id sent.

Example requests:

GET /algorithms/popular/recommendations?user_id=1&num_recs=5
Host: example.com
Accept: application/json, text/javascript
Content-Length: 20
POST /algorithms/popular/recommendations
Host: example.com
Accept: application/json, text/javascript
Content-Length: 26

Data: { "user_id" : 1, "num_recs" : 5 }

Example response:

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 178

{
"recommendations": [
        {
            "item": 356.0,
            "score": 341.0
        },
        {
            "item": 296.0,
            "score": 324.0
        },
        {
            "item": 318.0,
            "score": 311.0
        },
        {
            "item": 593.0,
            "score": 304.0
        },
        {
            "item": 260.0,
            "score": 291.0
        }
    ]
}
Query Parameters
  • user_id (int) – user id to get recommendations for

  • num_recs (int) – number of recommendations to return

JSON Parameters
  • user_id (int) – user id to get recommendations for.

  • num_recs (int) – number of recommendations to return.

GET | POST /algorithms/(string: algo)/predictions

Get predictions using the algorithm, user_id and items sent.

Example requests:

GET /algorithms/bias/predictions?user_id=1&items=5,102,203,304,400
Host: example.com
Accept: application/json, text/javascript
Content-Length: 33
POST /algorithms/bias/predictions
Host: example.com
Accept: application/json, text/javascript
Content-Length: 39

Data: { "user_id" : 1, "items" : 5,102,203,304,400 }

Example response:

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 212

{
"predictions": [
        {
            "item": 5,
            "score": 3.268
        },
        {
            "item": 102,
            "score": 2.591
        },
        {
            "item": 203,
            "score": 3.304
        },
        {
            "item": 304,
            "score": 3.333
        },
        {
            "item": 400,
            "score": 3.544
        }
    ]
}
Query Parameters
  • user_id (int) – user id to get predictions for

  • items (list_of_ints) – items to get predictions for

JSON Parameters
  • user_id (int) – user id to get predictions for

  • items (list_of_ints) – items to get predictions for

GET /algorithms/(string: algo)/info

Get the model file information from the algorithm sent.

Example requests:

GET /algorithms/popular/info
Host: example.com
Accept: application/json, text/javascript

Example response:

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 105

{
    "model": {
        "creation_date": "2020-08-28 18:38:42",
        "size": 200.826,
        "updated_date": "2020-08-21 18:32:55"
    }
}
PUT /algorithms/(string: algo)/modelfile

Update the model file for the algorithm and file sent.

Example requests:

PUT /algorithms/popular/modelfile
Host: example.com
Content-Length: 103863987
Content-Type: multipart/form-data;

Example response:

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 15

{ 'result' : 200 }