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.

Endpoints »

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
Query »
Query example (first 5 results)

https://ihp-wins.unesco.org/en/api/3/action/datastore_search?resource_id=f07cdd11-e892-435f-b3ba-c0873b7812bc&limit=5

Query example (results containing 'medio-ambiente')

https://ihp-wins.unesco.org/en/api/3/action/datastore_search?resource_id=f07cdd11-e892-435f-b3ba-c0873b7812bc&q=medio-ambiente

Query example (via SQL statement)

https://ihp-wins.unesco.org/en/api/3/action/datastore_search_sql?sql=SELECT * from "f07cdd11-e892-435f-b3ba-c0873b7812bc" WHERE title LIKE 'medio-ambiente'

Example: Python »

(ckanapi: RemoteCKAN)

Query example (first 5 results)


from ckanapi import RemoteCKAN

rc = RemoteCKAN('https://ihp-wins.unesco.org/en/', apikey=API_TOKEN)
result = rc.action.datastore_search(
    resource_id="f07cdd11-e892-435f-b3ba-c0873b7812bc",
    limit=5,
)
print(result['record'])

            
Query example (results containing 'medio-ambiente')


from ckanapi import RemoteCKAN

rc = RemoteCKAN('https://ihp-wins.unesco.org/en/', apikey=API_TOKEN)
result = rc.action.datastore_search(
  resource_id="f07cdd11-e892-435f-b3ba-c0873b7812bc",
    filters={
      subject: ['medio-ambiente'],
      stage: "active",
    },
)
print(result['record'])

              
Query example (via SQL statement)

from ckanapi import RemoteCKAN

rc = RemoteCKAN('https://ihp-wins.unesco.org/en/', apikey=API_TOKEN)
result = rc.action.datastore_search_sql(
    sql="""SELECT * from "f07cdd11-e892-435f-b3ba-c0873b7812bc" WHERE title LIKE 'medio-ambiente'"""
)
print(result['records'])

              
Example: Javascript »
Query example (first 5 results)


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: 'f07cdd11-e892-435f-b3ba-c0873b7812bc',
      limit: 5,
  })
})
await resp.json()
            
Query example (results containing 'medio-ambiente')


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: 'f07cdd11-e892-435f-b3ba-c0873b7812bc',
      filters: {
          subject: ['medio-ambiente'],
          stage: 'active'
      }
  })
})
await resp.json()
                
Query example (via SQL statement)


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 "'f07cdd11-e892-435f-b3ba-c0873b7812bc'" WHERE title LIKE 'medio-ambiente'`
  })
})
await resp.json()
                
Example: curl »
Query example (first 5 results)

  
  curl https://ihp-wins.unesco.org/en/api/3/action/datastore_search \
  -H"Authorization:$API_TOKEN" -d '
{
  "resource_id": "f07cdd11-e892-435f-b3ba-c0873b7812bc",
  "limit": 5
}'
          
Query example (results containing 'medio-ambiente')


curl https://ihp-wins.unesco.org/en/api/3/action/datastore_search \
-H"Authorization:$API_TOKEN" -d '
{
"resource_id": "f07cdd11-e892-435f-b3ba-c0873b7812bc",
  "filters": {
    "subject": ["medio-ambiente"],
    "stage": "active"
  }
}'
              
Query example (via SQL statement)


curl https://ihp-wins.unesco.org/en/api/3/action/datastore_search_sql \
  -H"Authorization:$API_TOKEN" -d @- <<END
{
  "sql": "SELECT * FROM \"f07cdd11-e892-435f-b3ba-c0873b7812bc\" WHERE title LIKE 'medio-ambiente'"
}
END
              
Example: R »
Query example (first 5 results)


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 = 'f07cdd11-e892-435f-b3ba-c0873b7812bc',
        limit = 5))
    req_perform %>% 
    resp_body_json

            
Query example (results containing 'medio-ambiente')


  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 = 'f07cdd11-e892-435f-b3ba-c0873b7812bc',
          filters = list('medio-ambiente'),
          stage = "active"))
      req_perform %>% 
      resp_body_json

              
Query example (via SQL statement)


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 "f07cdd11-e892-435f-b3ba-c0873b7812bc" WHERE title LIKE 'medio-ambiente'")
    req_perform %>% 
    resp_body_json