POST /api/v2/collections/:collection_id/public
Set as public

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Examples

// Successful request
POST /api/v2/collections/GhLTmioeWQ_4nI1Dhg1Q/public
200
{
  "is_public": true
}
// If :collection_id is not found
POST /api/v2/collections/not-found-id/public
404
{
  "error": "collection not found"
}
// Is public already
POST /api/v2/collections/jf69dEAnXi5d7CTM8emI/public
400
{
  "error": "Collection is public already"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

POST /api/v2/collections/:collection_id/private
Set as private

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Examples

// Successful request
POST /api/v2/collections/4cdi5CK5WEMW_dKiVvNm/private
200
{
  "is_public": false
}
// If :collection_id is not found
POST /api/v2/collections/not-found-id/private
404
{
  "error": "collection not found"
}
// Is private already
POST /api/v2/collections/B_RsGOhZFL9IFlXBhHMo/private
400
{
  "error": "Collection is private already"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

GET /api/v2/collections/:collection_id/all_users
List all users who are allowed to see this entity

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Examples

// Successful request
GET /api/v2/collections/I2rD4ylQZIMCTCUewmKX/all_users
200
{
  "users": [
    {
      "id": 10,
      "first_name": null,
      "last_name": null,
      "email": "admin-user-10@example.com",
      "user_role": {
        "name": "admin"
      }
    }
  ]
}
// If :collection_id is not found
GET /api/v2/collections/not-found-id/all_users
404
{
  "error": "collection not found"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

GET /api/v2/collections/:collection_id/users
List users

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Examples

// Successful request
GET /api/v2/collections/NqBS2omjhF98MdwJP1QB/users
200
{
  "users": [
    {
      "id": 12,
      "first_name": null,
      "last_name": null,
      "email": "admin-user-12@example.com",
      "user_role": {
        "name": "admin"
      }
    }
  ]
}
// If :collection_id is not found
GET /api/v2/collections/not-found-id/users
404
{
  "error": "collection not found"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

POST /api/v2/collections/:collection_id/users/:user_id
Add user

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Examples

// Successful request
POST /api/v2/collections/fgVAOSO3BkzNe_SG78u2/users/15
200
{
  "ok": "User 15 was added succesfully"
}
// User is already added
POST /api/v2/collections/bfklNyRN3AooTU-6V65z/users/17
400
{
  "error": "User is already member of this Collection"
}
// If :collection_id is not found
POST /api/v2/collections/not-found-id/users/18
404
{
  "error": "collection not found"
}
// If :user_id is not found
POST /api/v2/collections/sCFJJLvA4B-xg9vLMWoX/users/not-found-id
404
{
  "error": "Couldn't find User with 'id'=not-found-id"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

DELETE /api/v2/collections/:collection_id/users/:user_id
Remove user

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Examples

// Successful request
DELETE /api/v2/collections/PczA0D6_6062iM9YvGdb/users/22
200
{
  "ok": "User 22 was removed succesfully"
}
// User does not belong to entity
DELETE /api/v2/collections/dDaGhEpc1wiMfU1KnerD/users/24
400
{
  "error": "User is not a member of this Collection"
}
// If :collection_id is not found
DELETE /api/v2/collections/not-found-id/users/25
404
{
  "error": "collection not found"
}
// If :user_id is not found
DELETE /api/v2/collections/5PYVcDRQsTfeGuYFLNcr/users/not-found-id
404
{
  "error": "Couldn't find User with 'id'=not-found-id"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

POST /api/v2/collections/:collection_id/guests
Invite guest by email

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Params

Param name Description
email
required

Email

Validations:

  • Must be a String

Examples

// Successful request
POST /api/v2/collections/kSC6NWYt-nEfC1yEbIW0/guests
{
  "email": "example-email@example.com"
}
200
{
  "users": [
    {
      "id": 28,
      "first_name": null,
      "last_name": null,
      "email": "admin-user-28@example.com",
      "user_role": {
        "name": "admin"
      }
    },
    {
      "id": 29,
      "first_name": null,
      "last_name": null,
      "email": "example-email@example.com",
      "user_role": {
        "name": "guest"
      }
    }
  ]
}
// Successful request
POST /api/v2/collections/U9QovyOZeApaXzzuHw6R/guests
{
  "email": "admin-user-29@example.com"
}
400
{
  "error": "User already exists"
}
// If :collection_id is not found
POST /api/v2/collections/not-found-id/guests
{
  "email": "example-email@example.com"
}
404
{
  "error": "collection not found"
}
// Failed request
POST /api/v2/collections/not-found-id/guests
404
{
  "error": "collection not found"
}
// Successful request
POST /api/v2/collections/ubWcohbSFUdGEjv2vGe3/guests
{
  "email": "testiemail@tvtools.fi"
}
200
{
  "users": [
    {
      "id": 59,
      "first_name": null,
      "last_name": null,
      "email": "admin-user-58@example.com",
      "user_role": {
        "name": "admin"
      }
    },
    {
      "id": 60,
      "first_name": null,
      "last_name": null,
      "email": "testiemail@tvtools.fi",
      "user_role": {
        "name": "guest"
      }
    }
  ]
}
// User with given email does not already exist
POST /api/v2/collections/ksT2J4QGhvhsLkFVD0nB/guests
{
  "email": "testiemail@tvtools.fi"
}
200
{
  "users": [
    {
      "id": 61,
      "first_name": null,
      "last_name": null,
      "email": "admin-user-59@example.com",
      "user_role": {
        "name": "admin"
      }
    },
    {
      "id": 62,
      "first_name": null,
      "last_name": null,
      "email": "testiemail@tvtools.fi",
      "user_role": {
        "name": "guest"
      }
    }
  ]
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

GET /api/v2/collections/:collection_id/user_groups
Get user groups

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Examples

// Successful request
GET /api/v2/collections/iJjOBm6uWo26MGKijlLS/user_groups
200
{
  "user_groups": [
    {
      "id": 1,
      "name": "user-group-1",
      "description": "Sample user group for tests",
      "created_at": "2023-11-27T09:42:43.662Z",
      "updated_at": "2023-11-27T09:42:43.662Z",
      "users": []
    }
  ]
}
// If :collection_id is not found
GET /api/v2/collections/not-found-id/user_groups
404
{
  "error": "collection not found"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

POST /api/v2/collections/:collection_id/user_groups/:user_group_id
Add user group

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Examples

// Successful request
POST /api/v2/collections/4SWY1hUqC9dMptxNs66l/user_groups/2
200
{
  "ok": "User group 2 was added succesfully"
}
// User group is already added
POST /api/v2/collections/eUlaxtOinioj-WTsl9DZ/user_groups/3
400
{
  "error": "User group with id 3 is already part of this Collection"
}
// If :collection_id is not found
POST /api/v2/collections/not-found-id/user_groups/4
404
{
  "error": "collection not found"
}
// If :user_group_id is not found
POST /api/v2/collections/F_XY4mBq4xq5b6nT5z-e/user_groups/not-found-id
404
{
  "error": "Couldn't find UserGroup with 'id'=not-found-id"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

DELETE /api/v2/collections/:collection_id/user_groups/:user_group_id
Remove user group

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Examples

// Successful request
DELETE /api/v2/collections/Cg-3pdHh80ghToVECsg4/user_groups/5
200
{
  "ok": "User group 5 was removed succesfully"
}
// User does not belong to entity
DELETE /api/v2/collections/dTyMzjwQ6ZX3Tq_xvi3z/user_groups/6
400
{
  "error": "User group with id 6 is not part of this Collection"
}
// If :collection_id is not found
DELETE /api/v2/collections/not-found-id/user_groups/7
404
{
  "error": "collection not found"
}
// If :user_group_id is not found
DELETE /api/v2/collections/HckPQfa5hm7f3bgjqn9g/user_groups/not-found-id
404
{
  "error": "Couldn't find UserGroup with 'id'=not-found-id"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

GET /api/v2/collections/:collection_id/history/:cursor
Get history

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Examples

// Successful request
GET /api/v2/collections/OLgheC_dwJjhj5xOZxp9/history/0
200
{
  "history": {
    "results": [
      {
        "id": 78,
        "user_id": 0,
        "event_type": "USER_LINKED",
        "created_at": "2023-11-27T09:42:46.370Z",
        "updated_at": "2023-11-27T09:42:46.370Z",
        "event_targets": [
          {
            "target_type": "User",
            "target": {
              "id": 42,
              "first_name": null,
              "last_name": null
            }
          },
          {
            "target_type": "Collection",
            "target": {
              "id": 32,
              "elasticsearch_id": "OLgheC_dwJjhj5xOZxp9",
              "title": "Sample Collection"
            }
          }
        ]
      },
      {
        "id": 77,
        "user_id": 42,
        "event_type": "COLLECTION_CREATED",
        "created_at": "2023-11-27T09:42:46.341Z",
        "updated_at": "2023-11-27T09:42:46.341Z",
        "event_targets": [
          {
            "target_type": "Collection",
            "target": {
              "id": 32,
              "elasticsearch_id": "OLgheC_dwJjhj5xOZxp9",
              "title": "Sample Collection"
            }
          }
        ]
      }
    ],
    "next_cursor": null
  }
}
// If :collection_id is not found
GET /api/v2/collections/-1/history/0
404
{
  "error": "collection not found"
}
// Unprocessable entity
GET /api/v2/collections/0fIlq_2dpPZQbk68D2Vj/history/test
422
{
  "error": "Invalid parameter 'cursor' value \"test\": Invalid cursor"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

GET /api/v2/collections
List collection IDs for current user

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Examples

// Successful request
GET /api/v2/collections
200
{
  "collections": []
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

GET /api/v2/collections/:collection_id
Get a collection

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Params

Param name Description
collection_id
required

Collection ID

Validations:

  • Must be a String

Examples

// Failed request
GET /api/v2/collections/not-found-id
404
{
  "error": "collection not found"
}
// Successful request
GET /api/v2/collections/30DYGn7og_Nm7NO49piR
200
{
  "collection": {
    "id": "30DYGn7og_Nm7NO49piR",
    "title": "Sample Collection",
    "description": "Sample collection description.",
    "category": null,
    "tags": [],
    "owner": "admin-user-46@example.com",
    "media_type": "collection",
    "isPublic": false,
    "created_date": "2023-11-27T09:42:47.269Z",
    "modification_date": "2023-11-27T09:42:47.269Z",
    "original_title": "Sample Collection"
  }
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

POST /api/v2/collections/:collection_id/assets
Add asset to collection

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Params

Param name Description
asset_id
required

Asset ID

Validations:

  • Must be a String

Examples

// Successful request
POST /api/v2/collections/jg2JP_9S8fgeyV329THf/assets
{
  "asset_id": "K9KLrMpCrvd3qhKq_8_v"
}
200
{
  "message": "asset successfully added to collection"
}
// Failed request, collection not found
POST /api/v2/collections/not-found-id/assets
{
  "asset_id": "9fh0LOnC-gGcqjvAtq0m"
}
404
{
  "error": "collection not found"
}
// Failed request, asset not found
POST /api/v2/collections/UPeuRofIxLcDWpm8QGEM/assets
{
  "asset_id": "not-found-id"
}
400
{
  "error": "asset not found"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

DELETE /api/v2/collections/:collection_id/assets
Remove asset from collection

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Params

Param name Description
asset_id
required

Asset ID

Validations:

  • Must be a String

Examples

// Successful request
DELETE /api/v2/collections/gH20SjWYJn32EJxHllH7/assets
{
  "asset_id": "h4AhHBYgmrqEfH7xje3w"
}
200
{
  "message": "asset successfully removed from collection"
}
// Failed request, collection not found
DELETE /api/v2/collections/not-found-id/assets
{
  "asset_id": "47y5_rnFsmKd2TiFWHuJ"
}
404
{
  "error": "collection not found"
}
// Failed request, asset not found
DELETE /api/v2/collections/m9uiNo3Tjlwlr1s4VRES/assets
{
  "asset_id": "not-found-id"
}
400
{
  "error": "asset not found"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

POST /api/v2/collections
Create a new collection

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Params

Param name Description
title
required

Title

Validations:

  • Must be a String

description
optional

Description

Validations:

  • Must be a String

category
optional

Category

Validations:

  • Must be a String

tags
optional

Tags

Validations:

  • Must be an array of String

Examples

// Successful request
POST /api/v2/collections
{
  "title": "Test Collection",
  "description": "Test description"
}
200
{
  "collection": {
    "id": "Mmt55dqXeNE5xxRUvkQh",
    "title": "Test Collection",
    "description": "Test description",
    "category": null,
    "tags": [],
    "owner": "admin-user-47@example.com",
    "media_type": "collection",
    "isPublic": false,
    "created_date": "2023-11-27T09:42:47.546Z",
    "modification_date": "2023-11-27T09:42:47.546Z",
    "original_title": "Test Collection"
  }
}
// Failed request
POST /api/v2/collections
{
  "title": "Testing too long title: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "description": "Test description"
}
400
{
  "error": "Title is too long (maximum is 255 characters)"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

PUT /api/v2/collections/:collection_id
Update collection metadata

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Params

Param name Description
title
optional

Title

Validations:

  • Must be a String

description
optional

Description

Validations:

  • Must be a String

category
optional

Category

Validations:

  • Must be a String

tags
optional

Tags

Validations:

  • Must be an array of String

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

DELETE /api/v2/collections/:collection_id
Delete collection

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Params

Param name Description
collection_id
required

Collection ID

Validations:

  • Must be a String

Examples

// Successful request
DELETE /api/v2/collections/frYI-VQ7Sg0Z3NRhtoN-
200
{
  "collection": true
}
// Failed request
DELETE /api/v2/collections/not-found-id
404
{
  "error": "collection not found"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters