Log in

  • About COLABIS
  • Data Management
    • API Documentation
      • 52°N Series API Documentation
        • DWD Alerts
        • Weather Platforms
      • CKAN API
      • Emissions API
  • AGILE 2018 Workshop
  • Partners
  • Contact
  • Publications
  • Legal notice

CKAN API

 

Please follow the API guide of CKAN at http://docs.ckan.org/en/latest/api/index.html to get a common understanding of the capabilities and the workflow of how to use CKANs included API.

Extended API Reference

  • ckan.logic.action.geoserver_publish_ogc(context, data_dict)

    Publish a qualified dataset as OGC complied service on a geoserver. The user must have permission to 'edit' the dataset. Return True if the publishing process was successful and False otherwise.

    Parameter:

    • package_id (string) - the id of the package for publish
    • join_key (string) - the key if database table joins are necessary

    Return type: boolean

  • ckan.logic.action.geoserver_unpublish_ogc(context, data_dict)
    Unpublish a already published dataset from geoserver. The user must have permission to 'edit' the dataset. Return True if the unpublishing process was successful and False otherwise.

    Parameter:

    • package_id (string) - the id of the package for unpublish

    Return type: boolean

Application Example

The action API of CKAN is extended with new endpoints:

  • /api/3/action/geoserver_publish_ogc to publish a package
  • /api/3/action/geoserver_unpublish_ogc to unpublish a package

Example in python:

import urllib2
import urllib
import json

request = urllib2.Request('http://YOUR_SERVER/api/3/action/geoserver_publish_ogc')
 

To use this endpoints you have to create a dictionary and provide your API key in an HTTP request. So include it in an Authorization header like in this python code:

request.add_header('Authorization', 'YOUR KEY')
 

The dictionary has to have information about the package which should be published or unpublished [mandatory] and can have information about the keys which should be used when a join over different tables is necessary.

Example in python:

dataset_dict = {
    'package_id': 'ID_OF_PACKAGE', # the id of the package for update
    'join_key': 'KEY_FOR_JOIN' # the key if database table joins are necessary
}
 

The response of this request should claim that everything worked and the package has been published / unpublished

data_string = urllib.quote(json.dumps(dataset_dict))
response = urllib2.urlopen(request, data_string)
 
Top
Copyright © colabis.de 2022 All rights reserved. Custom Design by Youjoomla.com
YJSimpleGrid Joomla! Templates Framework official website
CKAN API