Skip to main content

A service of the Centre for Coastal Management · University of Cape Coast, Ghana

Regional Oceans and Coastal DataHub

Contribute

Data API

The API is free to use, read-only and needs no account or key. Base URL: https://rocdatahub.ucc.edu.gh/api/v1

Endpoints

  • GET https://rocdatahub.ucc.edu.gh/api/v1/datasets lists published datasets, newest first (by relevance when q is set), with pagination links.
  • GET https://rocdatahub.ucc.edu.gh/api/v1/datasets/{slug} returns one dataset. An unpublished or withdrawn dataset returns 404, as on the website.

Parameters for the list

q
Text search over titles and descriptions.
organization
Data partner slug.
category
Data category slug.
country
Country slug (the data partner's country).
updated_since
Only datasets updated on or after this date, as YYYY-MM-DD. Anything else is a 422.
page
Page number, starting at 1.
per_page
Datasets per page: 1 to 100, default 20. A value over 100 is rejected with a 422, not clamped.

Fields

Each dataset has the fields below. Responses wrap them in a "data" key; the list also carries "links" and "meta" for pagination.

slug
Stable identifier; use it in the show endpoint.
title
Dataset title.
abstract
Abstract text (may contain Markdown), or null.
url
The dataset page on this site.
access
open, on_request or metadata_only.
access_note
The data partner's note on how to ask for access, or null.
doi
Registered DOI (for example 10.1234/abcd), or null.
licence
Object with name and slug, or null.
partner
Object with name, slug and url of the data partner, or null.
authors
List of objects with name and orcid (orcid may be null).
categories
List of objects with name and slug.
countries
List of objects with name and slug.
spatial_coverage
List of study sites with name, latitude and longitude (coordinates may be null).
temporal_coverage
ISO 8601 interval such as 2019-01-01/2021-12-31, or null.
citation
Ready-to-use APA citation text.
published_at
ISO 8601 timestamp.
updated_at
ISO 8601 timestamp.
files
List of objects with name, format and url. Empty unless the dataset is open.

Files and access

File links appear only for open datasets, exactly as for an anonymous visitor on the website. For on-request and metadata-only datasets the files list is always empty; ask the data partner through the dataset page.

Rate limit

60 requests per minute per IP address. Every response carries X-RateLimit-Limit and X-RateLimit-Remaining. Past the limit you get 429 with a Retry-After header (seconds). Browsers may call the API from any origin (CORS, GET only).

Example

GET https://rocdatahub.ucc.edu.gh/api/v1/datasets/mangrove-cover-ghana
{
  "data": {
    "slug": "mangrove-cover-ghana",
    "title": "Mangrove cover, Ghana",
    "abstract": "Annual mangrove extent mapped from satellite imagery.",
    "url": "https://rocdatahub.ucc.edu.gh/dataset/mangrove-cover-ghana",
    "access": "open",
    "access_note": null,
    "doi": "10.1234/abcd",
    "licence": { "name": "Creative Commons Attribution 4.0 (CC-BY-4.0)", "slug": "cc-by-4-0" },
    "partner": { "name": "Example Partner", "slug": "example-partner", "url": "https://rocdatahub.ucc.edu.gh/data-partner/example-partner" },
    "authors": [ { "name": "Ama Mensah", "orcid": "0000-0002-1825-0097" } ],
    "categories": [ { "name": "Biological", "slug": "biological" } ],
    "countries": [ { "name": "Ghana", "slug": "ghana" } ],
    "spatial_coverage": [ { "name": "Keta lagoon", "latitude": 5.92, "longitude": 0.99 } ],
    "temporal_coverage": "2019-01-01/2021-12-31",
    "citation": "Mensah, A. (2022). Mangrove cover, Ghana. The ROC Data Hub. https://doi.org/10.1234/abcd",
    "published_at": "2022-03-01T09:00:00+00:00",
    "updated_at": "2022-06-15T12:30:00+00:00",
    "files": [ { "name": "extent", "format": "csv", "url": "https://rocdatahub.ucc.edu.gh/dataset/mangrove-cover-ghana/resource/1/download" } ]
  }
}