Search for content using a name and optional fields to filter, use your generated token in the a header as the authorization bearer token.
{info} The url for searching for content is:
https://app.safestream.info/api/v1/content
.
Method | URI | Headers |
---|---|---|
GET | /content |
Authorization: Bearer {token} |
{
"name" : "required|string|min:3",
"year" : "optional|digits:4",
"content_type" : "optional|string",
"page" : "optional|number"
}
None
{info} The
name
is the only required attribute required to make a search for content.
Pagination instructions and routes will be returned in the API response.
{info} The
content_type
is used to filter content, either movie, tv-show or you-tube.
{info} Basic search example using a name
{
"name" : "bones"
}
{success} Success Response
Code 200
Content
{
"current_page": 1,
"data": [
{
"id": 2422,
"name": "Bones",
"year": 2001,
"content_type": {
"slug": "movie"
}
},
{
"id": 2423,
"name": "Bones",
"year": 2005,
"content_type": {
"slug": "tv-show"
}
},
{
"id": 2424,
"name": "Bones Brigade: An Autobiography",
"year": 2012,
"content_type": {
"slug": "movie"
}
}
],
"first_page_url": "https://app.safestream.info/api/v1/content?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "https://app.safestream.info/api/v1/content?page=1",
"next_page_url": null,
"path": "https://app.safestream.info/api/v1/content",
"per_page": 5,
"prev_page_url": null,
"to": 3,
"total": 3
}
{danger} Error unauthorised Response, bad authorisation bearer token used.
Code 401
Reason This action is unauthorized
Content
{
"message": "Unauthenticated."
}
{danger} Error Response, name param used length too small.
Code 422
Reason Unprocessable Entity
Content
{
"message": "The given data was invalid.",
"errors": {
"name": [
"The name must be at least 3 characters."
]
}
}
{danger} Error Response, optional validation failed.
Code 422
Reason Unprocessable Entity
Content
{
"message": "The given data was invalid.",
"errors": {
"year": [
"A 4 digit year is required to search for content"
],
"content_type": [
"Define a content_type: \"movie\", \"tv-show\" or \"you-tube\""
]
}
}