Skip to content

Instantly share code, notes, and snippets.

@sergei-maertens
Created September 23, 2019 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergei-maertens/96df25eacef074aad4cd261150980426 to your computer and use it in GitHub Desktop.
Save sergei-maertens/96df25eacef074aad4cd261150980426 to your computer and use it in GitHub Desktop.
Overview of available Common Ground client libraries in Python

Python client libraries for Common Ground APIs

In the Common ground vision, data is retrieved from and mutated at the source. In practice, this means that a number of RESTful APIs are to be consumed to interact with the source.

This document provides an overview of available tooling for Python ecosystems.

The assumptions (and thus, requirements for the APIs) for this set of tooling are:

  • APIs are RESTful
  • APIs are documented in OpenAPI 3.0.x format, provided at {api_root}/schema/openapi.yaml
  • APIs exchange data in JSON format with the application/json content-type
  • APIs may be accessible only via NLX outways

OAS client library

gemma-zds-client is a client library driven by the openapi.yaml schema provided by the API.

Currently, it does not intelligently transform schema type information into native Python objects, i.e. every value is a string, float, integer, None or any of the collection types (dict, list).

It does, however, provide a client class implementation suitable for working with NLX and handling URL rewrites. See also the NLX URL rewriter.

Status: stable.

NLX URL rewriter

NLX outways change the URLs of APIs - a path prefix of {organisation}/{service} is added. You're also no longer accessing the canonical address, but your own, local outway address which is often not understood by the service when using URL-references.

nlx-url-rewriter is a Django package to handle this. You maintain the mapping of canonical address to outway address, and the rewriter modifies the data in place that you pass to it.

There is a pending issue for NLX to change to a transparent proxy, which will remove the need for URL-rewriting.

Status: beta.

ZGW Consumers

zgw-consumers is another Django package allowing you to store configuration. You can define a list of known services and the required credentials (client_id and secret). It is aware of the following API types:

  • ZRC
  • DRC
  • ZTC
  • BRC
  • NRC
  • AC

Extra API types can be supported easily. It provides an interface to build a client instance from a Service in the database.

Very useful if combined with a configuration tool where you can point to the primary service for a given domain, or for switching between NLX-enabled or non-NLX-enabled services.

Can easily work with NLX, since the config allows you to point to the NLX-enabled client class.

Status: stable.

Django-Camunda

django-camunda is a Django package allowing you to configure your Camunda process engine location, and interact with it.

It provides building blocks to start a camunda process via their REST API, has support for Celery for async tasks and an interface definition to handle custom variable types for Camunda processes.

Status: alpha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment