Zugriff auf Ressourcen per Web-Schnittstelle mit umfangreichen Suchmöglichkeiten. Weitere Information gibt es in der CKAN Data API und DataStore Dokumentation.
Code Beispielecurl https://data.kaltimprov.go.id/de/api/action/datastore_search \
-H"Authorization:$API_TOKEN" -d '
{
"resource_id": "ec1ab0d5-a499-4687-b450-a232bba1c24f",
"limit": 5,
"q": "jones"
}'
const resp = await fetch(`https://data.kaltimprov.go.id/de/api/action/datastore_search`, {
method: 'POST',
headers: {
'content-type': 'application/json',
authorization: API_TOKEN
},
body: JSON.stringify({
resource_id: 'ec1ab0d5-a499-4687-b450-a232bba1c24f',
limit: 5,
q: 'jones'
})
})
await resp.json()
$json = @'
{
"resource_id": "ec1ab0d5-a499-4687-b450-a232bba1c24f",
"limit": 5,
"q": "jones"
}
'@
$response = Invoke-RestMethod https://data.kaltimprov.go.id/de/api/action/datastore_search`
-Method Post -Body $json -Headers @{"Authorization"="$API_TOKEN"}
$response.result.records
(es wird die ckanapi Client-Bibliothek genutzt)
from ckanapi import RemoteCKAN
rc = RemoteCKAN('https://data.kaltimprov.go.id/de/', apikey=API_TOKEN)
result = rc.action.datastore_search(
resource_id="ec1ab0d5-a499-4687-b450-a232bba1c24f",
limit=5,
q="jones",
)
print(result['records'])
library(httr2)
req <- request("https://data.kaltimprov.go.id/de/api/action/datastore_search")
result <- req %>%
req_headers(Authorization = API_TOKEN) %>%
req_body_json(list(
resource_id = 'ec1ab0d5-a499-4687-b450-a232bba1c24f',
limit = 5,
q = 'jones'))
req_perform %>%
resp_body_json
Ergebnisse ermitteln mit entweder "watershed" oder "survey" als Thema und "active" als Status.
curl https://data.kaltimprov.go.id/de/api/action/datastore_search \
-H"Authorization:$API_TOKEN" -d '
{
"resource_id": "ec1ab0d5-a499-4687-b450-a232bba1c24f",
"filters": {
"subject": ["watershed", "survey"],
"stage": "active"
}
}'
const resp = await fetch(`https://data.kaltimprov.go.id/de/api/action/datastore_search`, {
method: 'POST',
headers: {
'content-type': 'application/json',
authorization: API_TOKEN
},
body: JSON.stringify({resource_id: 'ec1ab0d5-a499-4687-b450-a232bba1c24f', filters: {
subject: ['watershed', 'survey'],
stage: 'active'
}})})
await resp.json()
$json = @'
{
"resource_id": "ec1ab0d5-a499-4687-b450-a232bba1c24f",
"filters": {
"subject": ["watershed", "survey"],
"stage": "active"
}
}
'@
$response = Invoke-RestMethod https://data.kaltimprov.go.id/de/api/action/datastore_search`
-Method Post -Body $json -Headers @{"Authorization"="$API_TOKEN"}
$response.result.records
from ckanapi import RemoteCKAN
rc = RemoteCKAN('https://data.kaltimprov.go.id/de/', apikey=API_TOKEN)
result = rc.action.datastore_search(
resource_id="ec1ab0d5-a499-4687-b450-a232bba1c24f",
filters={
"subject": ["watershed", "survey"],
"stage": "active",
},
)
print(result['records'])
library(httr2)
req <- request("https://data.kaltimprov.go.id/de/api/action/datastore_search")
result <- req %>%
req_headers(Authorization = API_TOKEN) %>%
req_body_json(list(
resource_id='ec1ab0d5-a499-4687-b450-a232bba1c24f',
filters = list(
subject = list("watershed", "survey"),
stage = "active")))
req_perform %>%
resp_body_json
Einige API Endpunkte können mit einem GET Befehl angefragt werden.
Abfragebeispiel (erste 5 Ergebnisse) Abfragebeispiel (Ergebnisse die 'jones' enthalten)