Skip to content

API Documentation

Diana Lovette edited this page Jan 5, 2024 · 2 revisions

Local Contexts Hub API

An in-depth API Guide is available here.

The Local Contexts Hub (LC Hub) API's purpose is to fetch Labels and Notices associated with a particular Local Contexts Hub Project via a GET request.

Base URLs

API base url for the official Local Contexts Hub:

https://localcontextshub.org/api/v1/

API base url for the test site:
https://sandbox.localcontextshub.org/api/v1/

List of Projects

This call will return a project's title, providers_id, project_privacy, date_added and date_modified as well as the unique_id, which will be used to fetch the detailed view of a project.
To get a list of all public and discoverable projects:

/projects/

Example dummy response that returns all available projects:

[
    {
        "unique_id": "3dbf5acc-e602-45a6-a45a-13c14efgbe8d",
        "providers_id": tk-66fqj,
        "title": "Sample Project One",
        "project_privacy": "Public",
        "date_added": "2022-01-05T18:18:17.078138Z",
        "date_modified": "2022-01-05T18:18:17.078194Z"
    },
    {
        "unique_id": "6dbf5acc-e602-45a6-a45a-13c14efgbe8d",
        "providers_id": null,
        "title": "Sample Project Two",
        "project_privacy": "Discoverable",
        "date_added": "2022-01-05T18:18:17.078138Z",
        "date_modified": "2022-01-05T18:18:17.078194Z"
    },
    {
        "unique_id": "6dbf5acc-e602-45a6-a45a-13c14efgbe8d",
        "providers_id": null,
        "title": "Sample Project Three",
        "project_privacy": "Public",
        "date_added": "2022-01-05T18:18:17.078138Z",
        "date_modified": "2022-01-05T18:18:17.078194Z"
    },
]

Project List Filtering

Project list can be filtered by unique_id, providers_id or title with the following call:
(unique_id and providers_id cannot be partial, must be exact.)

/projects/?search=<UNIQUE_ID|PROVIDERS_ID|TITLE>

This will return all the relevant projects.

About Project IDs

When a Project is created in the Local Contexts Hub, it will automatically be assigned a randomly generated 36 alphanumeric UUID to the unique_id field in the following format: 8-4-4-4-12, where each of the numbers represent the number of randomized alphanumerics (hyphens are constant) with all letters always being lowercase. Here are some examples of what this id would look like:

2303177e-ff5c-11eb-9a03-0242ac130003
acef9b22-5a8d-4536-a624-fe3f68d140d4
d03cce00-9e36-4ad1-98bc-1abaf1e0e983

Project Detail (Notices and Labels)

Project detail can be accessed with the unique_id:

/projects/<PROJECT_UNIQUE_ID>/

A Project with a TK Notice will look like this:

{
    "unique_id": "acef9b22-5a8d-4536-a624-fe3f68d140d4",
    "title": "Example Project from an Institution",
    "providers_id": null,
    "project_page": "https://sandbox.localcontextshub.org/projects/acef9b22-5a8d-4536-a624-fe3f68d140d4",
    "project_privacy": "Public",
    "date_added": "2021-10-22T18:15:41.507481Z",
    "date_modified": "2021-10-22T18:15:41.507513Z",
    "created_by": [
        {
            "institution": {
                "id": 5,
                "institution_name": "Sample Institution"
            },
            "researcher": null,
            "community": null
        }
    ],
    "notice": [
        {
            "notice_type": "traditional_knowledge",
            "name": "Traditional Knowledge (TK) Notice",
            "img_url": "https://storage.googleapis.com/local-contexts-hub.appspot.com/labels/notices/tk-notice.png",
            "svg_url": "https://storage.googleapis.com/local-contexts-hub.appspot.com/labels/notices/tk-notice.svg",
            "default_text": "The TK (Traditional Knowledge) Notice is a visible notification that there are accompanying cultural rights and responsibilities that need further attention for any future sharing and use of this material. The TK Notice may indicate that TK Labels are in development and their implementation is being negotiated.",
            "created": "2022-07-19T22:33:06.316937Z",
            "updated": "2022-07-19T22:33:06.370628Z"
        }
    ],
    "sub_projects": [],
    "related_projects": []
}

Example of Project with multiple Notices:

{
    "unique_id": "79d40f45-73f6-48ab-9d3f-f5589431386c",
    "providers_id": null,
    "project_page": "https://localcontextshub.org/projects/79d40f45-73f6-48ab-9d3f-f5589431386c",
    "title": "Sample Project with Three Notices",
    "project_privacy": "Public",
    "date_added": "2022-07-19T22:33:05.973140Z",
    "date_modified": "2022-07-19T22:33:05.973166Z",
    "created_by": [
        {
            "institution": {
                "id": 1,
                "institution_name": "Sample Institution"
            },
            "researcher": null,
            "community": null
        }
    ],
    "notice": [
        {
            "notice_type": "attribution_incomplete",
            "name": "Attribution Incomplete Notice",
            "img_url": "https://storage.googleapis.com/local-contexts-hub.appspot.com/labels/notices/ci-attribution-incomplete.png",
            "svg_url": "https://storage.googleapis.com/local-contexts-hub.appspot.com/labels/notices/ci-attribution-incomplete.svg",
            "default_text": "Collections and items in our institution have incomplete, inaccurate, and/or missing attribution. We are using this notice to clearly identify this material so that it can be updated, or corrected by communities of origin. Our institution is committed to collaboration and partnerships to address this problem of incorrect or missing attribution.",
            "created": "2022-07-19T22:33:06.522116Z",
            "updated": "2022-07-19T22:33:06.571964Z"
        },
        {
            "notice_type": "biocultural",
            "name": "Biocultural (BC) Notice",
            "img_url": "https://storage.googleapis.com/local-contexts-hub.appspot.com/labels/notices/bc-notice.png",
            "svg_url": "https://storage.googleapis.com/local-contexts-hub.appspot.com/labels/notices/bc-notice.svg",
            "default_text": "The BC (Biocultural) Notice is a visible notification that there are accompanying cultural rights and responsibilities that need further attention for any future sharing and use of this material or data. The BC Notice recognizes the rights of Indigenous peoples to permission the use of information, collections, data and digital sequence information (DSI) generated from the biodiversity or genetic resources associated with traditional lands, waters, and territories. The BC Notice may indicate that BC Labels are in development and their implementation is being negotiated.",
            "created": "2022-07-19T22:33:06.421373Z",
            "updated": "2022-07-19T22:33:06.471864Z"
        },
        {
            "notice_type": "traditional_knowledge",
            "name": "Traditional Knowledge (TK) Notice",
            "img_url": "https://storage.googleapis.com/local-contexts-hub.appspot.com/labels/notices/tk-notice.png",
            "svg_url": "https://storage.googleapis.com/local-contexts-hub.appspot.com/labels/notices/tk-notice.svg",
            "default_text": "The TK (Traditional Knowledge) Notice is a visible notification that there are accompanying cultural rights and responsibilities that need further attention for any future sharing and use of this material. The TK Notice may indicate that TK Labels are in development and their implementation is being negotiated.",
            "created": "2022-07-19T22:33:06.316937Z",
            "updated": "2022-07-19T22:33:06.370628Z"
        }
    ],
    "sub_projects": [],
    "related_projects": []
}

Once Labels have been applied they replace the Notice(s) so the updated response will look like this.
This is an example response that returns a TK and a BC Label:

{
    "unique_id": "e4c0de12-973a-4957-865b-d1f624983637",
    "title": "Sample Project Two",
    "bclabels": [
        {
            "unique_id": "g4c0de12-973b-4957-855b-d1f624983737",
            "name": "BC Open to Commercialization (BC C)",
            "label_type": "commercialization",
            "language_tag": "en",
            "language": "English",
            "default_text": "This Label is being used to indicate that [community name or authorizing party] is open to commercialization opportunities that might derive from any information, collections, data and DSI to which this Label is connected. As a primary party in any partnership and collaboration opportunities that emerge from the use of these resources, we retain an express interest in any future negotiations.",
            "img_url": "https://storage.googleapis.com/local-contexts-hub.appspot.com/labels/bclabels/bc-open-to-commercialization.png",
            "community": "Sample Community",
            "created": "2021-07-08T19:54:22.262903Z",
            "updated": "2021-07-08T20:44:10.229491Z"
        },
    ],
    "tklabels": [
        {
            "unique_id": "f4c0de12-573a-4957-865b-d1f624983637",
            "name": "TK Attribution (TK A)",
            "label_type": "attribution",
            "language_tag": "en",
            "language": "English",
            "default_text": "This label is being used to correct historical mistakes or exclusions pertaining to this material. This is especially in relation to the names of the people involved in performing or making this work and/or correctly naming the community from which it originally derives. As a user you are being asked to also apply the correct attribution in any future use of this work.",
            "img_url": "https://storage.googleapis.com/anth-ja77-local-contexts-8985.appspot.com/labels/tklabels/tk-attribution.png",
            "community": "Sample Tribe",
            "created": "2021-07-07T18:42:44.789165Z",
            "updated": "2021-07-08T20:44:59.150527Z"
        },
    ],
    "sub_projects": [],
    "related_projects": [],
}

The response includes default text for each Notice and Label, an image URL, and which community created the Label.

Sub and Related Projects

Some Projects might have related or sub Projects, which will be displayed as Project unique_id arrays in the Project Detail calls:

    "sub_projects": [
        "cfa99b34-1e9c-4113-ae28-53897e3d932a",
        "90f6f1bf-f3ad-460e-a7f1-78ab6eaaf5f5"
    ],
    "related_projects": [
        "dfa99b34-1e6c-4153-aw28-53567e3d932a",
        "73f6f1bf-f3ad-460e-a7f1-78kb6baaf5f5"
    ],

Get multiple Projects by unique_id

Multiple Projects can be queried at a time, separated by commas. There is no limit to how many Projects can be queried at once.

/projects/multi/<PROJECT1_UNIQUE_ID>,<PROJECT2_UNIQUE_ID>,<PROJECT3_UNIQUE_ID>

The response will include Project detail view grouped by notices_only, labels_only or no_labels_or_notices.

Projects by Researcher or Institution ID

Institution or researcher IDs can be found in the settings of the account dashboard, this is the institution ID that will be used for this call:

/projects/institutions/<INSTITUTION_ID>

/projects/researchers/<RESEARCHER_ID>

Projects by Institution ID and Provider's ID

/projects/institutions/<INSTITUTION_ID>/<PROJECT_PROVIDERS_ID>

Projects by User ID

Projects can also be fetched by user ID. This will fetch a list of public or discoverable projects by a particular LC Hub user's ID. User ID can be found in Profile --> Edit Profile

/projects/users/USER_ID

Projects by Community

Projects can not be fetched by Community at this time.

Examples For Testing

Real sample projects from the sandbox hub that have been set up for testing

Project with Notices

https://sandbox.localcontextshub.org/api/v1/projects/c4ba03a0-3c4b-4fbb-837f-f5f3258c37e1/

Project with Labels

https://sandbox.localcontextshub.org/api/v1/projects/94a153b0-96eb-4868-89a1-2d27bf5c434c/

Open to Collaborate Notice

The Open to Collaborate Notice can be applied generally by anyone. Learn more about the OTC Notice.

Endpoint: /notices/open_to_collaborate

Response:

{
    "notice_type": "open_to_collaborate",
    "name": "Open to Collaborate Notice",
    "default_text": "Our institution is committed to the development of new modes of collaboration, engagement, and partnership with Indigenous peoples for the care and stewardship of past and future heritage collections.",
    "img_url": "https://storage.googleapis.com/local-contexts-hub.appspot.com/labels/notices/ci-open-to-collaborate.png",
    "svg_url": "https://storage.googleapis.com/local-contexts-hub.appspot.com/labels/notices/ci-open-to-collaborate.svg",
    "usage_guides": "https://localcontexts.org/support/downloadable-resources/"
}