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: Hwr-eXwuAy5MAC0fIhAaDA
Client: iEPW1SM55sEbhibEO5zI0w
Uid: narciso_von@ward.name
Host: example.org
Cookie: 

Route

POST /v1/collections

Body

{"collection":{"name":"labore","description":"Sed rerum repellendus sint voluptatem magni occaecati omnis.","owner_id":1225,"owner_type":"User","privacy":"public","items":[{"id":90,"type":"LearningObject","position":0}],"tags":[{"name":"neque"}],"subjects":[1,2],"educational_stages":[1,2]}}

cURL

curl "https://api.portalmec.c3sl.ufpr.br/v1/collections" -d '{"collection":{"name":"labore","description":"Sed rerum repellendus sint voluptatem magni occaecati omnis.","owner_id":1225,"owner_type":"User","privacy":"public","items":[{"id":90,"type":"LearningObject","position":0}],"tags":[{"name":"neque"}],"subjects":[1,2],"educational_stages":[1,2]}}' -X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-H "Access-Token: Hwr-eXwuAy5MAC0fIhAaDA" \
	-H "Client: iEPW1SM55sEbhibEO5zI0w" \
	-H "Uid: narciso_von@ward.name"

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=VHM1dGdQTUxla3BDR05hWU52L2pqWHRQRU04UTlheHZWUXFpanNwUlBqei84OXhJdXJYcmtXeFk3b2xLYXZ5MG96cTVvVHBDMlRJdjdpU1VFRm5iWVlkaXkwbHFsTUZER0Z3U0Rya0RGU01SZFZuZ3BMQVhNanl2dTg3a0ZnV0JubFBpTCtZL1pTc2UrRnlmQk90MmJrQldsZnoxclFiOGd2eVZhYm43b1dsRmFhK1JUN3lmOFIrMzZJTXFUMyttLS1rR3p2bG55VkI5MDFORXBkTDMzcytRPT0%3D--2cbbb79dfe29c180f1845986446f6fedf68c34ed; path=/; HttpOnly
Vary: Origin
ETag: W/"b5d839043aaba49f30824b15808c58e5"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 78219e52-98dd-4167-97c9-7a0628c03b26
X-Runtime: 0.268263
Content-Length: 4158

Status

201 Created

Body

{
  "id": 13,
  "name": "labore",
  "curator": null,
  "created_at": "2019-03-08T13:43:08.911Z",
  "updated_at": "2019-03-08T13:43:08.911Z",
  "description": "Sed rerum repellendus sint voluptatem magni occaecati omnis.",
  "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": "narciso_von@ward.name",
    "provider": "email",
    "cpf": null,
    "name": "César Soares",
    "description": "Soluta reprehenderit quibusdam est quia similique officia.",
    "submitter_request": "default",
    "education": "Quia dolores atque qui odit.",
    "score": 0.0,
    "cover": "",
    "role_ids": [
      1,
      1
    ],
    "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": "2019-03-08T13:43:08.712Z",
    "updated_at": "2019-03-08T13:43:08.806Z",
    "terms_accepted_at": null
  },
  "tags": [
    {
      "id": 746,
      "name": "neque",
      "created_at": "2019-03-08T13:43:08.923Z",
      "updated_at": "2019-03-08T13:43:08.923Z"
    }
  ],
  "subjects": [
    {
      "id": 1,
      "name": "Língua Espanhola",
      "created_at": "2019-03-08T13:42:18.041Z",
      "updated_at": "2019-03-08T13:42:18.041Z",
      "theme": false
    },
    {
      "id": 2,
      "name": "Língua Inglesa",
      "created_at": "2019-03-08T13:42:18.049Z",
      "updated_at": "2019-03-08T13:42:18.049Z",
      "theme": false
    }
  ],
  "educational_stages": [
    {
      "id": 1,
      "name": "Educação Infantil",
      "created_at": "2019-03-08T13:42:18.179Z",
      "updated_at": "2019-03-08T13:42:18.179Z"
    },
    {
      "id": 2,
      "name": "Ensino Fundamental I (1º até o 5º ano )",
      "created_at": "2019-03-08T13:42:18.184Z",
      "updated_at": "2019-03-08T13:42:18.184Z"
    }
  ],
  "collection_items": [
    {
      "id": 37,
      "position": 0,
      "collectionable": {
        "id": 90,
        "name": "LearningObject 90",
        "description": "Dolorem qui quis dolor dignissimos. Commodi ut ad. Ut voluptatem molestiae hic dolorum aspernatur enim. Eum cupiditate aut nisi.",
        "author": "Isabelly Ribeiro Jr.",
        "curator": null,
        "thumbnail": null,
        "object_type": "Software Educacional",
        "language": {
          "id": 9,
          "name": "Japonês",
          "created_at": "2019-03-08T13:42:17.293Z",
          "updated_at": "2019-03-08T13:42:17.293Z",
          "code": "jp"
        },
        "default_attachment_location": null,
        "default_attachment_id": null,
        "default_mime_type": null,
        "score": 0.713728202984921,
        "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": "2019-03-08T13:42:50.308Z",
        "published_at": null,
        "terms_of_service": null,
        "updated_at": "2019-03-08T13:42:50.308Z",
        "magnetlink": null,
        "publisher": {
          "id": 775,
          "email": null,
          "provider": "email",
          "cpf": null,
          "name": "Felícia Rezende",
          "description": "Cumque ut blanditiis commodi omnis ea.",
          "submitter_request": "default",
          "education": "Inventore odit tenetur sit deleniti.",
          "score": 0.0,
          "cover": "",
          "role_ids": [
            1
          ],
          "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": "2019-03-08T13:42:50.291Z",
          "updated_at": "2019-03-08T13:42:50.291Z",
          "terms_accepted_at": null
        },
        "tags": [
          {
            "id": 451,
            "name": "Tag 451",
            "created_at": "2019-03-08T13:42:50.318Z",
            "updated_at": "2019-03-08T13:42:50.318Z"
          },
          {
            "id": 452,
            "name": "Tag 452",
            "created_at": "2019-03-08T13:42:50.364Z",
            "updated_at": "2019-03-08T13:42:50.364Z"
          },
          {
            "id": 453,
            "name": "Tag 453",
            "created_at": "2019-03-08T13:42:50.393Z",
            "updated_at": "2019-03-08T13:42:50.393Z"
          },
          {
            "id": 454,
            "name": "Tag 454",
            "created_at": "2019-03-08T13:42:50.423Z",
            "updated_at": "2019-03-08T13:42:50.423Z"
          },
          {
            "id": 455,
            "name": "Tag 455",
            "created_at": "2019-03-08T13:42:50.453Z",
            "updated_at": "2019-03-08T13:42:50.453Z"
          }
        ],
        "subjects": [
          {
            "id": 4,
            "name": "Arte",
            "created_at": "2019-03-08T13:42:18.061Z",
            "updated_at": "2019-03-08T13:42:18.061Z",
            "theme": false
          },
          {
            "id": 2,
            "name": "Língua Inglesa",
            "created_at": "2019-03-08T13:42:18.049Z",
            "updated_at": "2019-03-08T13:42:18.049Z",
            "theme": false
          }
        ],
        "educational_stages": [
          {
            "id": 5,
            "name": "Ensino Superior",
            "created_at": "2019-03-08T13:42:18.196Z",
            "updated_at": "2019-03-08T13:42:18.196Z"
          }
        ],
        "attachments": [

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