-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3519 from open-formulieren/refactor/3489-document…
…ation Document new API client & update configuration documentation
- Loading branch information
Showing
33 changed files
with
205 additions
and
550 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
.. _developers_backend_api_clients: | ||
|
||
=========== | ||
API clients | ||
=========== | ||
|
||
Background | ||
========== | ||
|
||
Open Forms interfaces over HTTP with a bunch of third party APIs/services, for example | ||
to: | ||
|
||
* fetch :ref:`prefill data <configuration_prefill_index>` | ||
* :ref:`register <configuration_registration_index>` submission data | ||
* perform :ref:`service fetch <example_service_fetch>` | ||
|
||
There are different flavours of interaction - JSON services (including REST), but also | ||
SOAP (XML), StUF (SOAP/XML-based standard) and unknowns that the future may bring. | ||
|
||
In the Dutch (local) government landscape, there are some common patterns in how you | ||
connect with these services: | ||
|
||
* mutual TLS (mTLS) | ||
* basic auth credentials (username/password) | ||
* API key | ||
* Oauth2-based flows | ||
* IP allowlists | ||
|
||
Combinations of these patterns are possible too! | ||
|
||
Open Forms uses an abstraction that accounts for these variations while allowing | ||
developers to focus on the actual consuming of the service, packaged into the library | ||
`ape-pie <https://ape-pie.readthedocs.io/en/latest/>`_. | ||
|
||
Because it extends the core :mod:`requests` API, usage should feel familiar. | ||
|
||
You are encouraged to define your own service-specific subclasses to modify behaviour | ||
where needed. | ||
|
||
.. _developers_backend_api_clients_factories: | ||
|
||
Configuration factories | ||
======================= | ||
|
||
Configuration factories are a small abstraction that allow you to instantiate clients | ||
with the appropriate configuration/presets from sources holding the configuration | ||
details - for example database records. | ||
|
||
Such a factory must implemented the :class:`ape_pie.ConfigAdapter` protocol. | ||
|
||
Some examples that can serve as a reference: | ||
|
||
* :class:`zgw_consumers_ext.ape_pie.ServiceClientFactory` | ||
* :class:`soap.client.session_factory.SessionFactory` | ||
* :class:`stuf.service_client_factory.ServiceClientFactory` | ||
|
||
|
||
Reference | ||
========= | ||
|
||
ZGW-consumers (JSON-based/RESTful services) | ||
------------------------------------------- | ||
|
||
.. automodule:: zgw_consumers_ext.api_client | ||
:members: | ||
|
||
Zeep (SOAP client) | ||
------------------ | ||
|
||
Zeep supports a ``session`` keyword argument for its transport, which is plug and play | ||
with our base client. | ||
|
||
.. automodule:: soap.client | ||
:members: | ||
|
||
StUF (template based SOAP/XML) | ||
------------------------------ | ||
|
||
.. automodule:: stuf.client | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Core python libraries | ||
ape-pie | ||
bleach[css] >= 5 | ||
celery ~= 5.0 | ||
celery-once | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.