bcgov / bcgov/ckan-ui

Data API Button available on Tabular Resources stored in the Datastore - Missing (DDS-1133)

Open
#548 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Vue
Stars
13
Forks
4
PR merge metrics
No merged PRs in 30d

Description

There is a green button available to consumers when looking at resources stored in the datastore.

Need to determine the value of this and if it should be re-introduced.

In Cat Classic popup contains

![image](https://user-images.githubusercontent.com/32690119/132072431-6bf4ba79-0be6-4c53-932e-5c723503c85b.png)

**CKAN Data API**
Access resource data via a web API with powerful query support. Further information in the [main CKAN Data API and DataStore documentation](http://docs.ckan.org/en/latest/maintaining/datastore.html).

**Endpoints**

The Data API can be accessed via the following actions of the CKAN action API.

Create | https://catalogue.data.gov.bc.ca/api/3/action/datastore_create
-- | --
Update / Insert |https://catalogue.data.gov.bc.ca/api/3/action/datastore_upsert
Query | https://catalogue.data.gov.bc.ca/api/3/action/datastore_search
Query (via SQL) | https://catalogue.data.gov.bc.ca/api/3/action/datastore_search_sql

**Querying**

Query example (first 5 results)
https://catalogue.data.gov.bc.ca/api/3/action/datastore_search?resource_id=8f341d11-9966-4e1e-bffb-cb0d61fb10fd&limit=5

Query example (results containing 'jones')
https://catalogue.data.gov.bc.ca/api/3/action/datastore_search?resource_id=8f341d11-9966-4e1e-bffb-cb0d61fb10fd&q=jones

Query example (via SQL statement)
https://catalogue.data.gov.bc.ca/api/3/action/datastore_search_sql?sql=SELECT * from "8f341d11-9966-4e1e-bffb-cb0d61fb10fd" WHERE title LIKE 'jones'

**Example Java Script**:

A simple ajax (JSONP) request to the data API using jQuery.

var data = {
resource_id: '8f341d11-9966-4e1e-bffb-cb0d61fb10fd', // the resource id
limit: 5, // get 5 results
q: 'jones' // query for 'jones'
};
$.ajax({
url: 'https://catalogue.data.gov.bc.ca/api/3/action/datastore_search',
data: data,
dataType: 'jsonp',
success: function(data) {
alert('Total results found: ' + data.result.total)
}
});

**Example Python**

import urllib
url = 'https://catalogue.data.gov.bc.ca/api/3/action/datastore_search?resource_id=8f341d11-9966-4e1e-bffb-cb0d61fb10fd&limit=5&q=title:jones'
fileobj = urllib.urlopen(url)
print fileobj.read()

---

Feds' catalogue is a bit different

Example of one of our records they have scraped:
https://open.canada.ca/data/en/dataset/f8e27889-fb07-4f9d-b2ba-591578274b7c

They also show the link to the package API etc on their package page

Metadata:
Link to JSON format
DCAT (JSON-LD)
DCAT (XML)

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the resource page and the CKAN Data API and DataStore documentation referenced in the issue, then compare the current UI with the Cat Classic and federal catalogue examples. Determine whether the green Data API button should return and which links or endpoints it should expose; completion requires a decided scope and an agreed resource-page behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.