|
1 |
| -.. todo:: This feature is still in development and not ready for production yet. |
2 |
| - |
3 | 1 | .. _configuration_prefill_objects_api:
|
4 | 2 |
|
5 | 3 | ===========
|
6 | 4 | Objects API
|
7 | 5 | ===========
|
8 | 6 |
|
9 |
| -The `Objects API`_ stores data records of which the structure and shape are defined by a particular object type |
10 |
| -definition in the `Objecttypes API`_. These records can be used to pre-fill form fields if an object reference is |
11 |
| -passed when the form is started. |
| 7 | +*This plugin is also known as the "product prefill" feature.* |
| 8 | + |
| 9 | +The `Objects API`_ stores data records of which the structure and shape are defined by a |
| 10 | +particular object type definition in the `Objecttypes API`_. These records can be used |
| 11 | +to pre-fill form fields if an object reference is passed when the form is started. |
12 | 12 |
|
13 | 13 | .. note::
|
14 | 14 |
|
15 |
| - The service may contain sensitive data. It is advised to require DigiD/eHerkenning authentication on the form. You |
16 |
| - should be careful with how you pass the object references to the customers and set up the object type in a way that |
17 |
| - makes authentication checks possible (e.g. by storing the expected BSN or KVK number). |
| 15 | + The service likely contains sensitive data. It is required to use authentication on |
| 16 | + the form, as this information is used to test ownership of the referenced object. |
18 | 17 |
|
19 |
| -.. _`Objects API`: https://objects-and-objecttypes-api.readthedocs.io/en/latest/ |
20 |
| -.. _`Objecttypes API`: https://objects-and-objecttypes-api.readthedocs.io/en/latest/ |
| 18 | +What does the Open Forms administrator need? |
| 19 | +============================================ |
21 | 20 |
|
| 21 | +* An instance of the `Objecttypes API`_ with: |
| 22 | + |
| 23 | + - an API token to access the API from Open Forms |
| 24 | + - one or more objecttypes |
| 25 | + |
| 26 | +* An instance of the `Objects API`_ (v2.2+) with: |
| 27 | + |
| 28 | + - (API) access to the above Objecttypes API |
| 29 | + - an API token to access the Objects API from Open Forms |
| 30 | + - read permissions for the relevant Objecttypes - Open Forms reads records. |
22 | 31 |
|
23 | 32 | Configuration
|
24 | 33 | =============
|
25 | 34 |
|
26 |
| -1. In Open Forms, navigate to: **Forms** |
27 |
| -2. Click **Add form** |
28 |
| -3. Define the necessary form details and add the desired components |
29 |
| -4. Navigate to: **Variables** tab |
30 |
| -5. Navigate to: **User defined** subtab |
31 |
| -6. Click **Add variable** and fill in the data from the available options: |
| 35 | +Configuration is similar to :ref:`its registration counterpart <configuration_registration_objects>`, |
| 36 | +but only the objecttypes and objects services are required. |
32 | 37 |
|
33 |
| - * **Plugin**: Choose the *Objects API* plugin |
34 |
| - * **API Group**: Select the appropriate API group. These API groups should be set up |
35 |
| - by an administrator, via **Admin** > **Configuration** > **Prefill plugins** > |
36 |
| - **Objects API** > **Manage API groups** |
37 |
| - * **Objecttype**: Select the expected object type from the dropdown. |
38 |
| - * **Mappings**: Configure which property from the Objects API record needs to be |
39 |
| - assigned to which form variable. |
| 38 | +.. tip:: You can re-use the same API groups that are used for the registration plugin. |
40 | 39 |
|
41 |
| - For each form variable you want to pre-fill, add a new mapping. Then, on the left |
42 |
| - select the desired form variable, and on the right you can specify which property |
43 |
| - from the object type contains the value. |
| 40 | +To configure the Objects API follow these steps: |
44 | 41 |
|
45 |
| -7. Click **Save** |
46 |
| -8. Save the form |
| 42 | +#. In Open Forms, navigate to: **Configuration** > **Services** |
| 43 | +#. Create a service for the Objects API (ORC) where the form data will be registered. |
47 | 44 |
|
48 |
| -The Objects API configuration is now complete. |
| 45 | + a. Click **Service toevoegen**. |
| 46 | + b. Fill out the form: |
49 | 47 |
|
50 |
| -.. note:: |
| 48 | + * **Label**: *Fill in a human readable label*, for example: ``My Objects API`` |
| 49 | + * **Type**: Select the type: ``ORC`` |
| 50 | + * **API root url**: The root of this API, *for example* ``https://example.com/objecten/api/v2/`` |
| 51 | + |
| 52 | + * **Authorization type**: Select the option: ``API Key`` |
| 53 | + * **Header key**: Fill in ``Authorization`` |
| 54 | + * **Header value**: Fill in ``Token <tokenValue>`` where ``<tokenValue>`` is replaced by the token provided by the backend service |
| 55 | + * **OAS**: URL that points to the OAS, same URL as used for **API root url** with ``/schema/openapi.yaml`` added to it |
| 56 | + *for example:* ``https://example.com/objecten/api/v1/schema/openapi.yaml`` |
| 57 | + |
| 58 | + * **NLX**: Support for NLX can be selected here if enabled in the installation |
| 59 | + |
| 60 | + c. Click **Opslaan** and repeat to create configuration for the other component. |
| 61 | + |
| 62 | +#. Create a service for the Objecttypes API (ORC). |
| 63 | + |
| 64 | + a. Click **Service toevoegen**. |
| 65 | + b. Fill out the form: |
| 66 | + |
| 67 | + * **Label**: *Fill in a human readable label*, for example: ``My Objecttypes API`` |
| 68 | + * **Type**: Select the type: ``ORC`` |
| 69 | + * **API root url**: The root of this API, *for example* ``https://example.com/objecttypen/api/v2/`` |
| 70 | + |
| 71 | + * **Authorization type**: Select the option: ``API Key`` |
| 72 | + * **Header key**: Fill in ``Authorization`` |
| 73 | + * **Header value**: Fill in ``Token <tokenValue>`` where ``<tokenValue>`` is replaced by the token provided by the backend service |
| 74 | + * **OAS**: URL that points to the OAS, same URL as used for **API root url** with ``/schema/openapi.yaml`` added to it |
| 75 | + *for example:* ``https://example.com/objecttypen/api/v1/schema/openapi.yaml`` |
51 | 76 |
|
52 |
| - The Objects API prefill can be used not only for prefilling and showing the data to the user, |
53 |
| - but it can also work together with the Objects API registration plugin |
54 |
| - (see :ref:`Objects API configuration (English) <configuration_registration_objects>`) in order to make |
55 |
| - modifications to an existing object in the Objects API. This requires the form user to be the "owner" |
56 |
| - of the object and the necessary configuration in the Objects API registration at the form level |
57 |
| - (by choosing to update the existing object). |
| 77 | + * **NLX**: Support for NLX can be selected here if enabled in the installation |
58 | 78 |
|
59 |
| - .. image:: _assets/update_existing_object.png |
| 79 | + c. Click **Opslaan** and repeat to create configuration for the other component. |
| 80 | + |
| 81 | +#. Navigate to **Configuration** > **Configuration overview**. In the |
| 82 | + **Prefill plugins** group, click on **Manage API groups** for the **Objects API** line. |
| 83 | + |
| 84 | +#. Enter the following details: |
| 85 | + |
| 86 | + * **Name**: Enter a recognizable name, it will be displayed in various dropdowns. |
| 87 | + * **Objects API**: Select the Objects API (ORC) service created above |
| 88 | + * **Objecttypes API**: Select the Objecttypes API (ORC) service created above |
| 89 | + |
| 90 | + The remainder of the fields can be left empty. |
| 91 | + |
| 92 | +#. Click **Save** |
| 93 | + |
| 94 | +The Objects API configuration is now complete and can be selected as prefill backend in |
| 95 | +the form builder. When doing so, you will be able to select the desired object type and |
| 96 | +its version. |
| 97 | + |
| 98 | +Recommendations for the Objecttype JSON Schemas |
| 99 | +=============================================== |
| 100 | + |
| 101 | +The same recommendations apply as for the |
| 102 | +:ref:`registration plugin <configuration_registration_objects_objecttype_tips>`. We |
| 103 | +rely heavily on the JSON Schema specified in the object type. |
| 104 | + |
| 105 | +Technical |
| 106 | +========= |
| 107 | + |
| 108 | +Open Forms requires Objects API v2.2 or newer and the Objecttypes API v2.0 or newer. |
| 109 | + |
| 110 | +================ =============================================== |
| 111 | +Objects API Test status |
| 112 | +================ =============================================== |
| 113 | +2.2.x Manually verified |
| 114 | +2.3.x Manually verified |
| 115 | +2.4.x Manually verified, automated end-to-end testing |
| 116 | +================ =============================================== |
| 117 | + |
| 118 | +================ =============================================== |
| 119 | +Objecttypes API Test status |
| 120 | +================ =============================================== |
| 121 | +2.0.x Unknown |
| 122 | +2.1.x Manually verified |
| 123 | +2.2.x Manually verified, automated end-to-end testing |
| 124 | +================ =============================================== |
| 125 | + |
| 126 | +.. _`Objects API`: https://objects-and-objecttypes-api.readthedocs.io/en/latest/ |
| 127 | +.. _`Objecttypes API`: https://objects-and-objecttypes-api.readthedocs.io/en/latest/ |
0 commit comments