Overview

Base URL

The medialoopster Web API Root is /api/ which is appended to the end of the medialoopster URL.

In the sample calls throughout this documentation we use medialoopster-url as a placeholder for the medialoopster URL:

http://medialoospter-url/api/

On this Page

Versioning

medialoopster Web API uses Accept Header Versioning Scheme. To request a specific API version, the version number must be added to the HTTP Header Accept:

Accept: application/json; version=1

The use of the header addition is optional. If the version is missing, it defaults to the latest version available.

The Accept Header itself is required to determine the response Content-Type!

For the sake of brevity this header is not included in the sample calls throughout this documentation.

Access Test

medialoopster Web API provides a Ping-like resource to test if the API is accessible.


  Test API Access GET /ping/

Description

Test if the medialoopster Web API is accessible. This resource does not require authentication or any permission!

Properties

Title

Test api access

URL

/ping/

Method

GET


Headers

Name

Value

Required

Description

Accept

application/json; version=1

no

If a specific medialoopster Web API version is required, this header needs to be set.


Success Response

204 - No Content

Error Response

502 - Bad Gateway

503 - Service Not Available


Sample Call

curl -X GET http://ml-develop.local/api/ping/

Authentication

Unless otherwise noted, all medialoopster Web API requests require an authentication token in the form of "Token xxxxx" (where xxxxx is the generated token). The token can be acquired by any registered user. The authentication token must be provided through the HTTP Header Authorization.

For the sake of brevity this header is not included in the sample calls throughout this documentation.

In case the server cannot read the authentication token (i.e. the token is missing, wrong format) the server responds with:

401 - Unauthorized

{
  "errors": [
    {
      "status": "401",
      "code": "authentication_failed",
      "detail": "Invalid token.",
      "title": "Authetication has failed"
    }
  ]
}


  Get Authentication TokenPOST /token-auth/


Description

Generate an authentication token.


Properties

Title

Get authentication token

URL

/token-auth/

Method

POST



Header

NameValueRequiredDescription
Accept

application/json; version=1

noIf a specific medialoopster Web API version is required, this header needs to be set.

Data Params

Name

Type

Required

Description

username

string

yes

medialoopster user (e-mail address)
passwordstringyesPassword for the medialoopster user

Success Response

Code: 200

Content:

{
  "token": "eb2b3d60297859d1cb995ca65f508ef5798545dd"
}

Error Response

Code: 400

Content:

{
  "errors": [
    {
      "status": "400",
      "code": "authorization",
      "meta": {
        "type": "non_field"
      },
      "detail": "Unable to log in with provided credentials.",
      "title": "Validation Error"
    }
  ]
}

Sample Call

curl -X POST http://medialoopster-url/api/token-auth/ \
  -d username=joan%40nachtblau.tv \
  -d password=joanspassword

Content-Type

medialoopster Web API uses JSON for data formatting. Unless otherwise noted, all responses in this documentation are of the content type application/json (requires Accept header to be set to "application/json", see Versioning).

Aside from application/json medialoopster Web API also supports application/x-www-form-urlencoded for data sent by the client.


Pagination

When a resource collection is requested the returned data only contains a limited set of objects. To retrieve the remaining objects or a different subset of objects, the API client can use the query parameters limit and offset. By default the returned set of objects is limited system wide to 25 objects with a limit cap at 100 objects. Both values can be changed through system settings.

The server response contains the total amount of available objects in the custom HTTP header X-Total-Count.

In addition medialoopster Web API supports Link Based Header Pagination to help the API client to navigate through the collection. If applicable the possible links are next, prev, last and first like in the following example:

Link: 
 <http://medialoopster-url/api/videoassets/?limit=100&offset=2600>; rel="next", 
 <http://medialoopster-url/api/videoassets/?limit=100&offset=2400>; rel="prev", 
 <http://medialoopster-url/api/videoassets/?limit=100&offset=5100>; rel="last", 
 <http://medialoopster-url/api/videoassets/?limit=100>; rel="first"

For the sake of brevity the pagination is not included in the query parameter section throughout this documentation.