Access resource data via a web API with powerful query support. Further information in the main CKAN Data API and DataStore documentation.
The Data API can be accessed via the following actions of the CKAN action API.
Create | https://ihp-wins.unesco.org/en/api/3/action/datastore_create |
---|---|
Update / Insert | https://ihp-wins.unesco.org/en/api/3/action/datastore_upsert |
Query | https://ihp-wins.unesco.org/en/api/3/action/datastore_search |
Query (via SQL) | https://ihp-wins.unesco.org/en/api/3/action/datastore_search_sql |
(ckanapi: RemoteCKAN)
from ckanapi import RemoteCKAN
rc = RemoteCKAN('https://ihp-wins.unesco.org/en/', apikey=API_TOKEN)
result = rc.action.datastore_search(
resource_id="5dad31d2-e6d5-482d-aa41-00d2bd17c936",
limit=5,
)
print(result['record'])
from ckanapi import RemoteCKAN
rc = RemoteCKAN('https://ihp-wins.unesco.org/en/', apikey=API_TOKEN)
result = rc.action.datastore_search(
resource_id="5dad31d2-e6d5-482d-aa41-00d2bd17c936",
filters={
subject: ['medio-ambiente'],
stage: "active",
},
)
print(result['record'])
from ckanapi import RemoteCKAN
rc = RemoteCKAN('https://ihp-wins.unesco.org/en/', apikey=API_TOKEN)
result = rc.action.datastore_search_sql(
sql="""SELECT * from "5dad31d2-e6d5-482d-aa41-00d2bd17c936" WHERE title LIKE 'medio-ambiente'"""
)
print(result['records'])
const resp = await fetch(`https://ihp-wins.unesco.org/en/api/3/action/datastore_search`, {
method: 'POST',
headers: {
'content-type': 'application/json',
authorization: API_TOKEN
},
body: JSON.stringify({
resource_id: '5dad31d2-e6d5-482d-aa41-00d2bd17c936',
limit: 5,
})
})
await resp.json()
const resp = await fetch(`https://ihp-wins.unesco.org/en/api/3/action/datastore_search`, {
method: 'POST',
headers: {
'content-type': 'application/json',
authorization: API_TOKEN
},
body: JSON.stringify({
resource_id: '5dad31d2-e6d5-482d-aa41-00d2bd17c936',
filters: {
subject: ['medio-ambiente'],
stage: 'active'
}
})
})
await resp.json()
const resp = await fetch(`https://ihp-wins.unesco.org/en/api/3/action/datastore_search`, {
method: 'POST',
headers: {
'content-type': 'application/json',
authorization: API_TOKEN
},
body: JSON.stringify({
sql: `SELECT * FROM "'5dad31d2-e6d5-482d-aa41-00d2bd17c936'" WHERE title LIKE 'medio-ambiente'`
})
})
await resp.json()
curl https://ihp-wins.unesco.org/en/api/3/action/datastore_search \
-H"Authorization:$API_TOKEN" -d '
{
"resource_id": "5dad31d2-e6d5-482d-aa41-00d2bd17c936",
"limit": 5
}'
curl https://ihp-wins.unesco.org/en/api/3/action/datastore_search \
-H"Authorization:$API_TOKEN" -d '
{
"resource_id": "5dad31d2-e6d5-482d-aa41-00d2bd17c936",
"filters": {
"subject": ["medio-ambiente"],
"stage": "active"
}
}'
curl https://ihp-wins.unesco.org/en/api/3/action/datastore_search_sql \
-H"Authorization:$API_TOKEN" -d @- <<END
{
"sql": "SELECT * FROM \"5dad31d2-e6d5-482d-aa41-00d2bd17c936\" WHERE title LIKE 'medio-ambiente'"
}
END
library(httr2)
req <- request("https://ihp-wins.unesco.org/en/api/3/action/datastore_search")
result <- req %>%
req_headers(Authorization = API_TOKEN) %>%
req_body_json(list(
resource_id = '5dad31d2-e6d5-482d-aa41-00d2bd17c936',
limit = 5))
req_perform %>%
resp_body_json
library(httr2)
req <- request("https://ihp-wins.unesco.org/en/api/3/action/datastore_search")
result <- req %>%
req_headers(Authorization = API_TOKEN) %>%
req_body_json(list(
resource_id = '5dad31d2-e6d5-482d-aa41-00d2bd17c936',
filters = list('medio-ambiente'),
stage = "active"))
req_perform %>%
resp_body_json
library(httr2)
req <- request("https://ihp-wins.unesco.org/en/api/3/action/datastore_search_sql")
result <- req %>%
req_headers(Authorization = API_TOKEN) %>%
req_body_json(list(
sql="SELECT * from "5dad31d2-e6d5-482d-aa41-00d2bd17c936" WHERE title LIKE 'medio-ambiente'")
req_perform %>%
resp_body_json