-
Notifications
You must be signed in to change notification settings - Fork 7
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 #89 from maykinmedia/feature/more-docs
Added more documentation
- Loading branch information
Showing
17 changed files
with
1,183 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.. _api_index: | ||
|
||
================== | ||
API-specifications | ||
================== | ||
|
||
The Objects API and Objecttypes API are proposed as VNG API standards and are | ||
currently in review. Their specifications can be found below. | ||
|
||
====================== ========================================== | ||
API Specification version(s) | ||
====================== ========================================== | ||
`Objecttypes API`_ 1.0.0-alpha ( | ||
`Redoc <https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/maykinmedia/objecttypes-api/master/src/openapi.yaml>`__, | ||
`Swagger <https://petstore.swagger.io/?url=https://raw.githubusercontent.com/maykinmedia/objecttypes-api/master/src/openapi.yaml>`__ | ||
) | ||
`Objects API`_ 1.0.0-alpha ( | ||
`Redoc <https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/maykinmedia/objects-api/master/src/openapi.yaml>`__, | ||
`Swagger <https://petstore.swagger.io/?url=https://raw.githubusercontent.com/maykinmedia/objects-api/master/src/openapi.yaml>`__ | ||
) | ||
====================== ========================================== | ||
|
||
.. _`Objecttypes API`: https://github.com/maykinmedia/objecttypes-api | ||
|
||
.. _`Objects API`: https://github.com/maykinmedia/objects-api |
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,76 @@ | ||
# Environment configuration reference | ||
|
||
The Objects and Objecttypes API can be ran both as a Docker container or directly on a VPS or | ||
dedicated server. It relies on other services, such as database and cache | ||
backends, which can be configured through environment variables. | ||
|
||
## Available environment variables | ||
|
||
### Required | ||
|
||
* `DJANGO_SETTINGS_MODULE`: which environment settings to use. Available options: | ||
- `openpersonen.conf.docker` | ||
- `openpersonen.conf.dev` | ||
- `openpersonen.conf.ci` | ||
|
||
* `SECRET_KEY`: secret key that's used for certain cryptographic utilities. You | ||
should generate one via | ||
[miniwebtool](https://www.miniwebtool.com/django-secret-key-generator/) | ||
|
||
* `ALLOWED_HOSTS`: a comma separated (without spaces!) list of domains that | ||
serve the installation. Used to protect against `Host` header attacks. | ||
|
||
### Optional | ||
|
||
* `SITE_ID`: defaults to `1`. The database ID of the site object. You usually | ||
won't have to touch this. | ||
|
||
* `DEBUG`: defaults to `False`. Only set this to `True` on a local development | ||
environment. Various other security settings are derived from this setting! | ||
|
||
* `IS_HTTPS`: defaults to the inverse of `DEBUG`. Used to construct absolute | ||
URLs and controls a variety of security settings. | ||
|
||
* `DB_HOST`: hostname of the PostgreSQL database. Defaults to `localhost`, | ||
unless you're using the `docker` environment, then it defaults to `db`. | ||
|
||
* `DB_USER`: username of the database user. Defaults to `openzaak`, | ||
unless you're using the `docker` environment, then it defaults to `postgres`. | ||
|
||
* `DB_PASSWORD`: password of the database user. Defaults to `openzaak`, | ||
unless you're using the `docker` environment, then it defaults to no password. | ||
|
||
* `DB_NAME`: name of the PostgreSQL database. Defaults to `openzaak`, | ||
unless you're using the `docker` environment, then it defaults to `postgres`. | ||
|
||
* `DB_PORT`: port number of the database, defaults to `5432`. | ||
|
||
* `SENTRY_DSN`: URL of the sentry project to send error reports to. Default | ||
empty, i.e. -> no monitoring set up. Highly recommended to configure this. | ||
|
||
## Specifying the environment variables | ||
|
||
There are two strategies to specify the environment variables: | ||
|
||
* provide them in a `.env` file | ||
* start the Open Zaak processes (with uwsgi/gunicorn/celery) in a process | ||
manager that defines the environment variables | ||
|
||
### Providing a .env file | ||
|
||
This is the most simple setup and easiest to debug. The `.env` file must be | ||
at the root of the project - i.e. on the same level as the `src` directory ( | ||
NOT _in_ the `src` directory). | ||
|
||
The syntax is key-value: | ||
|
||
``` | ||
SOME_VAR=some_value | ||
OTHER_VAR="quoted_value" | ||
``` | ||
|
||
### Provide the envvars via the process manager | ||
|
||
If you use a process manager (such as supervisor/systemd), use their techniques | ||
to define the envvars. The Open Zaak implementation will pick them up out of | ||
the box. |
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,18 @@ | ||
.. _installation_index: | ||
|
||
Installation | ||
============ | ||
|
||
In addition to making its source code available publicly, the reference | ||
implementation for the Objects API and Objecttypes API are also maintained and | ||
work out-of-the-box for most use cases. | ||
|
||
For the sake of simplicity, we have chosen to use Docker and Docker Compose for | ||
this. | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
:caption: Further reading | ||
|
||
quickstart | ||
config |
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,99 @@ | ||
.. _installation_quickstart: | ||
|
||
Quickstart | ||
========== | ||
|
||
A simple ``docker-compose-quickstart.yml`` file is available to get the API's | ||
up and running in minutes. This file has some convenience settings to get | ||
started quickly and these should never be used for anything besides testing: | ||
|
||
* A default secret is set in the ``SECRET_KEY`` environment variable | ||
* A predefined database and database account is used. | ||
* API authorizations are disabled. | ||
|
||
With the above remarks in mind, let's go: | ||
|
||
Objecttypes API | ||
--------------- | ||
|
||
1. Create a project folder: | ||
|
||
.. code:: shell | ||
$ mkdir objecttypes-api | ||
$ cd objecttypes-api | ||
2. Download the ``docker-compose`` file: | ||
|
||
.. tabs:: | ||
|
||
.. tab:: Linux | ||
|
||
.. code:: shell | ||
$ wget https://raw.githubusercontent.com/maykinmedia/objecttypes-api/master/docker-compose-quickstart.yml -O docker-compose.yml | ||
.. tab:: Windows Powershell 3 | ||
|
||
.. code:: shell | ||
PS> wget https://raw.githubusercontent.com/maykinmedia/objecttypes-api/master/docker-compose-quickstart.yml -Odocker-compose.yml | ||
3. Start the Docker containers: | ||
|
||
.. code:: shell | ||
$ docker-compose up -d | ||
4. Import a demo set of objecttypes: | ||
|
||
.. code:: shell | ||
$ docker-compose -f docker-compose-quickstart.yml exec web src/manage.py loaddata demodata | ||
Objects API | ||
----------- | ||
|
||
1. Create a project folder: | ||
|
||
.. code:: shell | ||
$ mkdir objects-api | ||
$ cd objects-api | ||
2. Download the ``docker-compose`` file: | ||
|
||
.. tabs:: | ||
|
||
.. tab:: Linux | ||
|
||
.. code:: shell | ||
$ wget https://raw.githubusercontent.com/maykinmedia/objects-api/master/docker-compose-quickstart.yml -O docker-compose.yml | ||
.. tab:: Windows Powershell 3 | ||
|
||
.. code:: shell | ||
PS> wget https://raw.githubusercontent.com/maykinmedia/objects-api/master/docker-compose-quickstart.yml -Odocker-compose-quickstart.yml | ||
3. Start the Docker containers: | ||
|
||
.. code:: shell | ||
$ docker-compose up -d | ||
4. Import a demo set of objects (linking to the demo objecttypes): | ||
|
||
.. code:: shell | ||
$ docker-compose exec web src/manage.py loaddata demodata | ||
5. Retrieve an object via the Objects API in your webbrowser: | ||
|
||
.. code:: | ||
http://localhost:8000/api/v1/objects/ | ||
TODO: Auth, fixtures, objects... |
Binary file added
BIN
+179 KB
docs/introduction/_assets/multiple_objects_apis_using_national_objecttypes_api.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,39 @@ | ||
Definitions | ||
=========== | ||
|
||
Objecttype | ||
---------- | ||
|
||
A definition, represented as a JSON-schema, together with metadata about the | ||
objecttype. Each *objecttype* represents a collection of *objects* of similar form | ||
and/or function. | ||
|
||
Object | ||
------ | ||
|
||
A self-contained entity of data with its own identity, structured according to | ||
the JSON-schema of the *objecttype*. | ||
|
||
*Example* | ||
|
||
The *objecttype tree* has 2 attributes: `height` and `type`. A particular street | ||
has 3 trees, or rather, *3 objects of objecttype tree*, and they are: 1) | ||
`height`: 4.9m, `type`: oak, 2) `height`: 5.1m, `type`: oak, 3) `height`: 5.0m, | ||
`type`: pine tree. | ||
|
||
Objecttypes API | ||
--------------- | ||
|
||
An API to retrieve one or more *objecttypes*. | ||
|
||
The Objecttypes API aims to standardize various types of objects, on a national | ||
or just as easily on a local municipality level, and make them accessible as | ||
resources for other applications. | ||
|
||
Objects API | ||
----------- | ||
|
||
An API to retrieve, filter, search, write, update or delete *objects*. | ||
|
||
The Objects API aims to easily store and expose various objects according to | ||
the related **objecttype resource** in the *Objecttypes API*. |
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,51 @@ | ||
Features | ||
======== | ||
|
||
Below is a list of the high level features of the APIs. | ||
|
||
Objecttypes API | ||
--------------- | ||
|
||
* **JSON-schema validation** | ||
|
||
When creating a new objecttype, the JSON-schema is validated. Only valid | ||
JSON-schemas are allowed in the objecttype. | ||
|
||
* **Versioning** | ||
|
||
Objecttypes are versioned. This means you can create an objecttype but if the | ||
objecttype evolves, you can create a new version. | ||
|
||
* **Admin interface** | ||
|
||
You can create and inspect objecttypes via a user interface, meant for | ||
administrators. | ||
|
||
Objects API | ||
----------- | ||
|
||
* **Objecttype validation** | ||
|
||
When creating an object, the objecttype is inspected to see if all data is | ||
formatted according to the JSON-schema in the objecttype. | ||
|
||
* **Formal and administrative history** | ||
|
||
The history of each object is recorded on two axes: The formal (formele) | ||
history and the material (materiële) history. | ||
|
||
* **Geographic search** | ||
|
||
Objects can be searched with GeoJSON using an arbitrary geographical point or | ||
polygon. | ||
|
||
* **Arbitrary attribute filtering** | ||
|
||
Since the Objects API contains many different objects of different | ||
objecttypes, the attributes are different for each objecttype. The Objects | ||
API supports filtering on any attribute. | ||
|
||
* **Authorizations** | ||
|
||
With an API-token applications can get read or write access, per objecttype. | ||
These API-tokens can be configured in the admin interface. |
Oops, something went wrong.