Collections API

Collection is a group of educational content or another collection, which an user can show, create, update and destroy.

Creating a collection

POST /v1/collections

Parameters

Name Description
collection[name] The name of the collection
collection[description] The description of educational content of the collection
collection[owner_id] The id of the collection’s owner
collection[owner_type] Represents a type of the collections owner [User, Institution]
collection[privacy] Represents if collections is public, or not. [public, private]
collection[items] Items belongs to the collection [LearningObject, Collection]
collection[tags] Array with tags
collection[subjects] Array with subjects
collection[educational_stages] Array with educational stages

Request

Headers

Accept: application/json
Content-Type: application/json
Access-Token: taaqv7LaePJchyOw9Rk7ww
Client: DU1OL6BNQ_9AQDiLMvzwcQ
Uid: wellington.kaulke@hammesmuller.org
Host: example.org
Cookie: 

Route

POST /v1/collections

Body

{"collection":{"name":"nesciunt","description":"Ea voluptates accusantium ab et.","owner_id":1225,"owner_type":"User","privacy":"public","items":[{"id":90,"type":"LearningObject","position":0}],"tags":[{"name":"labore"}],"subjects":[1,2],"educational_stages":[1,2]}}

cURL

curl "https://api.portalmec.c3sl.ufpr.br/v1/collections" -d '{"collection":{"name":"nesciunt","description":"Ea voluptates accusantium ab et.","owner_id":1225,"owner_type":"User","privacy":"public","items":[{"id":90,"type":"LearningObject","position":0}],"tags":[{"name":"labore"}],"subjects":[1,2],"educational_stages":[1,2]}}' -X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-H "Access-Token: taaqv7LaePJchyOw9Rk7ww" \
	-H "Client: DU1OL6BNQ_9AQDiLMvzwcQ" \
	-H "Uid: wellington.kaulke@hammesmuller.org"

Response

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
Set-Cookie: _session_id=Nm1sZ1JFajhBVGhMNE1xZjBBVmp2NjE4ZjNXK0tJb3VoeFRkc2RxMTR1ZXZnSjJFUjNhYThQVm9Wc3FrdHdHMmpsZ3JtekRlUVNXeUV2anBwNkVBTXJTLzNZMzBFNmJST21TeWZyZHUxUjl3azBKY2ZVK3ovWkdpVzR0dlpUVnhsdmlOUHdQRnhXaEZxWUhXaHhGRlRkK2FLb0xPZVFmWFdLaG9EQTBXWXdrS3VSd1NLTXVmS0lsa05obmlydmpqLS1NV0hEQTg3R0xDK0JneXNqMEN0bTBRPT0%3D--3c09ed23d7d72e67f8ab72754c7620fe89285969; path=/; HttpOnly
Vary: Origin
ETag: W/"6c7d0daea6efc37c5813e75e80612c3e"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 75682335-73ca-4d11-91c0-2be0acbbe07a
X-Runtime: 0.282688
Content-Length: 4339

Status

201 Created

Body

{
  "id": 13,
  "name": "nesciunt",
  "curator": null,
  "created_at": "2021-02-25T14:04:43.177Z",
  "updated_at": "2021-02-25T14:04:43.177Z",
  "description": "Ea voluptates accusantium ab et.",
  "privacy": "public",
  "score": 0.0,
  "likes_count": 0,
  "liked": false,
  "followed": false,
  "reviewed": false,
  "complained": false,
  "review_average": 0.0,
  "thumbnail": "",
  "items_thumbnails": [

  ],
  "owner": {
    "id": 1225,
    "email": "wellington.kaulke@hammesmuller.org",
    "provider": "email",
    "cpf": null,
    "name": "Paulo Mendes",
    "description": "Libero ut veritatis est est et eligendi fugiat.",
    "submitter_request": "default",
    "education": "Quia sapiente similique nam commodi dolores temporibus officiis.",
    "score": 0.0,
    "cover": "",
    "role_ids": [
      8,
      8
    ],
    "institution_ids": [

    ],
    "avatar": "",
    "dspace_url": null,
    "dspace_handle": null,
    "dspace_sets": [

    ],
    "likes_count": 0,
    "followed": false,
    "complained": false,
    "follows_count": 0,
    "learning_objects_count": 0,
    "collections_count": 1,
    "created_at": "2021-02-25T14:04:42.975Z",
    "updated_at": "2021-02-25T14:04:43.072Z",
    "terms_accepted_at": null,
    "state": "active",
    "times_blocked": 0,
    "suspended_at": null,
    "reactivated_at": null,
    "ask_teacher_question": true
  },
  "tags": [
    {
      "id": 746,
      "name": "labore",
      "created_at": "2021-02-25T14:04:43.192Z",
      "updated_at": "2021-02-25T14:04:43.192Z"
    }
  ],
  "subjects": [
    {
      "id": 1,
      "name": "Língua Espanhola",
      "created_at": "2021-02-25T14:03:42.794Z",
      "updated_at": "2021-02-25T14:03:42.794Z",
      "theme": false
    },
    {
      "id": 2,
      "name": "Língua Inglesa",
      "created_at": "2021-02-25T14:03:42.811Z",
      "updated_at": "2021-02-25T14:03:42.811Z",
      "theme": false
    }
  ],
  "educational_stages": [
    {
      "id": 1,
      "name": "Educação Infantil",
      "created_at": "2021-02-25T14:03:43.230Z",
      "updated_at": "2021-02-25T14:03:43.230Z"
    },
    {
      "id": 2,
      "name": "Ensino Fundamental I (1º até o 5º ano )",
      "created_at": "2021-02-25T14:03:43.249Z",
      "updated_at": "2021-02-25T14:03:43.249Z"
    }
  ],
  "collection_items": [
    {
      "id": 37,
      "position": 0,
      "collectionable": {
        "id": 90,
        "name": "LearningObject 90",
        "description": "Sunt molestiae voluptas odio asperiores enim numquam sequi. Enim aut molestias iure voluptatibus nemo aliquid. Ut et occaecati veniam nesciunt.",
        "author": "Francisco Reis",
        "curator": null,
        "thumbnail": null,
        "object_type": "Outros",
        "language": [
          {
            "id": 2,
            "name": "Inglês",
            "created_at": "2021-02-25T14:03:40.676Z",
            "updated_at": "2021-02-25T14:03:40.676Z",
            "code": "en"
          }
        ],
        "default_attachment_location": null,
        "default_attachment_id": null,
        "submission_id": null,
        "default_mime_type": null,
        "score": 0.786112134848766,
        "state": "published",
        "review_average": 0.0,
        "link": null,
        "software": null,
        "license": null,
        "liked": false,
        "likes_count": 0,
        "downloads_count": 0,
        "views_count": 0,
        "reviewed": false,
        "complained": false,
        "shares_count": 0,
        "created_at": "2021-02-25T14:04:20.464Z",
        "published_at": null,
        "terms_of_service": null,
        "updated_at": "2021-02-25T14:04:20.464Z",
        "magnetlink": null,
        "publisher": {
          "id": 775,
          "email": null,
          "provider": "email",
          "cpf": null,
          "name": "Ofélia Pinto",
          "description": "Eos molestiae praesentium voluptatem.",
          "submitter_request": "default",
          "education": "Sit ut et omnis ducimus ab occaecati vel.",
          "score": 0.0,
          "cover": "",
          "role_ids": [
            8
          ],
          "institution_ids": [

          ],
          "avatar": "",
          "dspace_url": null,
          "dspace_handle": null,
          "dspace_sets": null,
          "likes_count": 0,
          "followed": false,
          "complained": false,
          "follows_count": 0,
          "learning_objects_count": 1,
          "collections_count": 0,
          "created_at": "2021-02-25T14:04:20.440Z",
          "updated_at": "2021-02-25T14:04:20.440Z",
          "terms_accepted_at": null,
          "state": "active"
        },
        "tags": [
          {
            "id": 451,
            "name": "Tag 451",
            "created_at": "2021-02-25T14:04:20.486Z",
            "updated_at": "2021-02-25T14:04:20.486Z"
          },
          {
            "id": 452,
            "name": "Tag 452",
            "created_at": "2021-02-25T14:04:20.529Z",
            "updated_at": "2021-02-25T14:04:20.529Z"
          },
          {
            "id": 453,
            "name": "Tag 453",
            "created_at": "2021-02-25T14:04:20.565Z",
            "updated_at": "2021-02-25T14:04:20.565Z"
          },
          {
            "id": 454,
            "name": "Tag 454",
            "created_at": "2021-02-25T14:04:20.601Z",
            "updated_at": "2021-02-25T14:04:20.601Z"
          },
          {
            "id": 455,
            "name": "Tag 455",
            "created_at": "2021-02-25T14:04:20.635Z",
            "updated_at": "2021-02-25T14:04:20.635Z"
          }
        ],
        "subjects": [
          {
            "id": 16,
            "name": "Química",
            "created_at": "2021-02-25T14:03:43.041Z",
            "updated_at": "2021-02-25T14:03:43.041Z",
            "theme": false
          },
          {
            "id": 5,
            "name": "Biologia",
            "created_at": "2021-02-25T14:03:42.871Z",
            "updated_at": "2021-02-25T14:03:42.871Z",
            "theme": false
          }
        ],
        "educational_stages": [
          {
            "id": 3,
            "name": "Ensino Fundamental II  (do 6º até o 9º ano)",
            "created_at": "2021-02-25T14:03:43.257Z",
            "updated_at": "2021-02-25T14:03:43.257Z"
          }
        ],
        "attachments": [

        ]
      },
      "collectionable_type": "LearningObject"
    }
  ]
}