Accédez aux données de la ressource via une API web supportant des requêtes puissantes . Further information in the main CKAN Data API and DataStore documentation.
Code examples:curl https://www.offenesdatenportal.de/fr/api/action/datastore_search \
-H"Authorization:$API_TOKEN" -d '
{
"resource_id": "b8d443f3-631b-49da-9acf-9178c335f6c4",
"limit": 5,
"q": "jones"
}'
const resp = await fetch(`https://www.offenesdatenportal.de/fr/api/action/datastore_search`, {
method: 'POST',
headers: {
'content-type': 'application/json',
authorization: API_TOKEN
},
body: JSON.stringify({
resource_id: 'b8d443f3-631b-49da-9acf-9178c335f6c4',
limit: 5,
q: 'jones'
})
})
await resp.json()
$json = @'
{
"resource_id": "b8d443f3-631b-49da-9acf-9178c335f6c4",
"limit": 5,
"q": "jones"
}
'@
$response = Invoke-RestMethod https://www.offenesdatenportal.de/fr/api/action/datastore_search`
-Method Post -Body $json -Headers @{"Authorization"="$API_TOKEN"}
$response.result.records
(using the ckanapi client library)
from ckanapi import RemoteCKAN
rc = RemoteCKAN('https://www.offenesdatenportal.de/fr/', apikey=API_TOKEN)
result = rc.action.datastore_search(
resource_id="b8d443f3-631b-49da-9acf-9178c335f6c4",
limit=5,
q="jones",
)
print(result['records'])
library(httr2)
req <- request("https://www.offenesdatenportal.de/fr/api/action/datastore_search")
result <- req %>%
req_headers(Authorization = API_TOKEN) %>%
req_body_json(list(
resource_id = 'b8d443f3-631b-49da-9acf-9178c335f6c4',
limit = 5,
q = 'jones'))
req_perform %>%
resp_body_json
Get results with either "watershed" or "survey" as subject and "active" as its stage:
curl https://www.offenesdatenportal.de/fr/api/action/datastore_search \
-H"Authorization:$API_TOKEN" -d '
{
"resource_id": "b8d443f3-631b-49da-9acf-9178c335f6c4",
"filters": {
"subject": ["watershed", "survey"],
"stage": "active"
}
}'
const resp = await fetch(`https://www.offenesdatenportal.de/fr/api/action/datastore_search`, {
method: 'POST',
headers: {
'content-type': 'application/json',
authorization: API_TOKEN
},
body: JSON.stringify({resource_id: 'b8d443f3-631b-49da-9acf-9178c335f6c4', filters: {
subject: ['watershed', 'survey'],
stage: 'active'
}})})
await resp.json()
$json = @'
{
"resource_id": "b8d443f3-631b-49da-9acf-9178c335f6c4",
"filters": {
"subject": ["watershed", "survey"],
"stage": "active"
}
}
'@
$response = Invoke-RestMethod https://www.offenesdatenportal.de/fr/api/action/datastore_search`
-Method Post -Body $json -Headers @{"Authorization"="$API_TOKEN"}
$response.result.records
from ckanapi import RemoteCKAN
rc = RemoteCKAN('https://www.offenesdatenportal.de/fr/', apikey=API_TOKEN)
result = rc.action.datastore_search(
resource_id="b8d443f3-631b-49da-9acf-9178c335f6c4",
filters={
"subject": ["watershed", "survey"],
"stage": "active",
},
)
print(result['records'])
library(httr2)
req <- request("https://www.offenesdatenportal.de/fr/api/action/datastore_search")
result <- req %>%
req_headers(Authorization = API_TOKEN) %>%
req_body_json(list(
resource_id='b8d443f3-631b-49da-9acf-9178c335f6c4',
filters = list(
subject = list("watershed", "survey"),
stage = "active")))
req_perform %>%
resp_body_json
On peut accéder à certains points d’extrémité de l’API au moyen d’une chaîne de requête GET.
Exemple de requête (5 premiers résultats) Exemple de requête (résultats contenant 'jones')