Run in Postman


API Docs

A CRUD interface to manage service consumers use the Postman collection to see all the details with the example responses, use your valid generated token in the header as the authorization bearer token.

Once a consumer has been setup use the Instant Recommendation feature to get a recommendation on whether a consumer should watch a piece of content.


Endpoint

{info} The url for managing consumers is: https://app.safestream.info/api/v1/consumer.

List all consumers

Get the paginated list of all of your consumers that use your service.

Method URI Headers
GET /consumer Authorization: Bearer {token}

{success} Success Response

Code 200

Content

{
    "current_page": 1,
    "data": [
        {
            "reference": "ClrbDokZ",
            "nudity": 5,
            "violence": 10,
            "language": 10,
            "hide_nudity": false,
            "hide_violence": true,
            "hide_language": false,
            "hide_sexual_assault": true,
            "hide_abuse": false,
            "hide_substance_abuse": true,
            "hide_drugs": false,
            "hide_racism": true
        },
        {
            "reference": "hUgmGz6w",
            "nudity": 1,
            "violence": 8,
            "language": 1,
            "nudity": 5,
            "hide_nudity": true,
            "hide_violence": true,
            "hide_language": false,
            "hide_sexual_assault": true,
            "hide_abuse": false,
            "hide_substance_abuse": true,
            "hide_drugs": false,
            "hide_racism": true
        },
    ...
    ],
    "first_page_url": "https://app.safestream.info/api/v1/consumer?page=1",
    "from": 1,
    "last_page": 472,
    "last_page_url": "https://app.safestream.info/api/v1/consumer?page=472",
    "next_page_url": "https://app.safestream.info/api/v1/consumer?page=2",
    "path": "https://app.safestream.info/api/v1/consumer",
    "per_page": 15,
    "prev_page_url": null,
    "to": 15,
    "total": 7068
}

Create a consumer

Create a new consumer with a unique reference, the reference should be non-identifiable and would be recommended to be a UUID that refers your user.

Endpoint

Method URI Headers
POST /consumer Authorization: Bearer {token}

Data Params

{
    "reference"         : "required|string"
}

{success} Success Response

Code 200

Content

{
    "data": {
        "reference": "ClrbDokZ"
    }
}

{danger} Error Response duplicate reference used

Code 422

Reason Unprocessable Entity

{
    "message": "The given data was invalid.",
    "errors": {
        "reference": [
            "This combination of reference, user id already exists."
        ]
    }
}

Read a single consumer

Get the content preferences of a single consumer

Method URI Headers
GET /consumer/{reference} Authorization: Bearer {token}

{success} Success Response

Code 200

Content

{
    "data": {
        "reference": "gIou2TWa",
        "nudity": 7,
        "violence": 8,
        "language": 1
    }
}

Update a consumer

Update a single consumers content preferences with a integer between 0 and 10 for nudity, violence and language. You can update individual preferences for a given consumers individual sensitivities which is backed by our powerful tagging system.

Method URI Headers
PUT /consumer/{reference} Authorization: Bearer {token}

Data Params

{
    "nudity"               : "integer|min:1|max:10|nullable",
    "violence"             : "integer|min:1|max:10|nullable",
    "language"             : "integer|min:1|max:10|nullable",
    "hide_nudity"          : "boolean",
    "hide_violence"        : "boolean",
    "hide_language"        : "boolean",
    "hide_sexual_assault"  : "boolean",
    "hide_abuse"           : "boolean",
    "hide_substance_abuse" : "boolean",
    "hide_drugs"           : "boolean",
    "hide_racism"          : "boolean"
}

{danger} Error Response incorrect validation

Code 422

Reason Unprocessable Entity

{
    "message": "The given data was invalid.",
    "errors": {
        "nudity": [
            "The nudity must be an integer."
        ]
    }
}

{success} Success Response

Code 200

Content

{
    "data": {
        "reference": "gIou2TWa",
        "nudity": 7,
        "violence": 8,
        "language": 1,
        "hide_nudity": false,
        "hide_violence": true,
        "hide_language": false,
        "hide_sexual_assault": true,
        "hide_abuse": false,
        "hide_substance_abuse": true,
        "hide_drugs": false,
        "hide_racism": true
    }
}

Delete a consumer

Delete a consumer and their preference from a service

Method URI Headers
DELETE /consumer/{reference} Authorization: Bearer {token}

{danger} Error Response user not found

Code 404

Reason Not Found

{success} Success Response

Code 200