Resources Endpoints

How Target Resources are gathered and formatted.

Resource Collection Endpoint

Targets that integrate with the Resources Collection API Endpoint must have a function that returns a specifically structured dataset. This structure allows us to recreate the hierarchy of the file structure on the front end. The endpoint is expecting a list of objects with the following structure:

{
    'kind': 'container',
    'kind_name': 'folder',
    'id': 'e16083a7-34df-436e-9f2e-e3bd3bb54e18',
    'container': 'e16083a7-34df-436e-9f2e-e3bd3bb54e18',
    'title': 'folder_name'
}

Structure definitions:

  • kind : Type of resource

    • options:

      • container

      • item

  • kind_name : Target specific name for that kind

    • For example OSF kind_names are:

      • node

      • folder

      • file

  • container : id of the container for the resource

    • For example if the resource is an file in a folder then the container value would be the id of the folder

  • id : id of the resource

  • title : title of the resource

Resource Detail Endpoint

When hitting the endpoint for details of a specific resource the payload, there is an extra field which allows for target specific data that might not be universal for all targets to be passed. The content ofextra will change depending on the type of the resource. For instance in OSF the following are the payloads for Project and File. You'll notice the extra field holds entirely different fields.

PROJECT PAYLOAD
{
    "kind": "container",
    "kind_name": "project",
    "id": "q5xmw",
    "title": "Private Project",
    "date_created": "2019-05-13T15:23:33.456041",
    "date_modified": "2019-05-14T14:01:03.507343",
    "hashes": {
        "md5": null,
        "sha256": null
    },
    "extra": {
        "category": "project",
        "fork": false,
        "current_user_is_contributor": true,
        "preprint": false,
        "current_user_permissions": [
            "read",
            "write",
            "admin"
        ],
        "custom_citation": null,
        "collection": false,
        "public": false,
        "subjects": [],
        "registration": false,
        "current_user_can_comment": true,
        "wiki_enabled": true,
        "node_license": null,
        "tags": [
            "Brett",
            "presqt",
            "Private"
        ],
        "size": null,
    }
}

FILE PAYLOAD
{
        "kind": "item",
        "kind_name": "file",
        "id": "5cd98518f244ec001ee8606b",
        "title": "23296359282_934200ec59_o.jpg",
        "date_created": "2019-05-13T14:54:17.129170Z",
        "date_modified": "2019-05-13T14:54:17.129170Z",
        "hashes": {
            "md5": "aaca7ef067dcab7cb8d79c36243823e4",
            "sha256": "ea94ce54261720c16abb508c6dcd1fd481c30c09b7f2f5ab0b79e3199b7e2b55"
        },
        "extra": {
            "last_touched": null,
            "materialized_path": "/Images/23296359282_934200ec59_o.jpg",
            "current_version": 1,
            "provider": "osfstorage",
            "path": "/5cd98518f244ec001ee8606b",
            "current_user_can_comment": true,
            "guid": null,
            "checkout": null,
            "tags": [],
            "size": 1773294,
        }
    }

Resource API Endpoints

pageResource Endpoints

Last updated