Skip to content

Resources REST API Documentation

vaibhav-sinha edited this page Jun 11, 2016 · 1 revision

Following resources are available through REST API. Given alongside is the respective endpoint.

  1. App - apps
  2. Category - categories
  3. Module - modules
  4. Playlist - playlists
  5. Content - contents
  6. PlaylistContent - playlist_contents
  7. Device - devices
  8. Location - locations
  9. Activity - activities

All endpoints follow the standard REST conventions. The end user only has permission to read resources, except in case of Activity.

List Resource

Returns json data about a all resource.

  • URL

    /{{endpoint}}

  • Method:

    GET

  • Query Params

    offset=[integer] limit=[integer] sortField=[string] sortDir=[ASC or DESC] - Must be specified if sortField is provided filters=[object]

  • Success Response:

    • Code: 200
      Content: [{ id : 12, name : "Michael Bloom" }, {id: 13, name : "Vaibhav Sinha"}]
  • Error Response:

    • Code: 401 UNAUTHORIZED
      Content: { error : "You are unauthorized to make this request." }

Show Resource

Returns json data about a single resource.

  • URL

    /{{endpoint}}/:id

  • Method:

    GET

  • URL Params

    Required:

    id=[integer]

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content: { id : 12, name : "Michael Bloom" }
  • Error Response:

    • Code: 404 NOT FOUND
      Content: { error : "Resource doesn't exist" }

    OR

    • Code: 401 UNAUTHORIZED
      Content: { error : "You are unauthorized to make this request." }

Create Resource

Creates a new resource.

  • URL

    /{{endpoint}}

  • Method:

    POST

  • Data Params

    The resource object

  • Success Response:

    • Code: 200
      Content: { id : 12, name : "Michael Bloom" }
  • Error Response:

    • Code: 400 BAD REQUEST
      Content: { error : "Name must be unique" }

    OR

    • Code: 401 UNAUTHORIZED
      Content: { error : "You are unauthorized to make this request." }

Update Resource

Updates an existing resource.

  • URL

    /{{endpoint}}/:id

  • Method:

    PUT

  • URL Params

    Required:

    id=[integer]

  • Data Params

    The resource object

  • Success Response:

    • Code: 200
      Content: { id : 12, name : "Michael Bloom" }
  • Error Response:

    • Code: 404 NOT FOUND
      Content: { error : "Resource not found" }

    OR

    • Code: 401 UNAUTHORIZED
      Content: { error : "You are unauthorized to make this request." }

Delete Resource

Deletes an existing resource.

  • URL

    /{{endpoint}}/:id

  • Method:

    DELETE

  • URL Params

    Required:

    id=[integer]

  • Success Response:

    • Code: 200
      Content: { id : 12, name : "Michael Bloom", status: "deleted" }
  • Error Response:

    • Code: 404 NOT FOUND
      Content: { error : "Resource not found" }

    OR

    • Code: 401 UNAUTHORIZED
      Content: { error : "You are unauthorized to make this request." }