From 2d2554e170996f2619fa8e6073c1e17b1b4569c1 Mon Sep 17 00:00:00 2001 From: Anvit Srivastav Date: Fri, 5 Dec 2025 16:10:27 -0800 Subject: [PATCH 1/2] Add docs for API create update delete endpoints Add documentation for the create, update, and delete information object endpoints. --- dev-manual/api/api-intro.rst | 6 ++++ dev-manual/api/create-io.rst | 62 ++++++++++++++++++++++++++++++++++++ dev-manual/api/delete-io.rst | 37 +++++++++++++++++++++ dev-manual/api/update-io.rst | 55 ++++++++++++++++++++++++++++++++ dev-manual/index.rst | 3 ++ index.rst | 3 ++ 6 files changed, 166 insertions(+) create mode 100644 dev-manual/api/create-io.rst create mode 100644 dev-manual/api/delete-io.rst create mode 100644 dev-manual/api/update-io.rst diff --git a/dev-manual/api/api-intro.rst b/dev-manual/api/api-intro.rst index 4ee95e46..546ed9a4 100644 --- a/dev-manual/api/api-intro.rst +++ b/dev-manual/api/api-intro.rst @@ -16,7 +16,10 @@ There are several endpoints available: * :ref:`Browse taxonomy terms ` * :ref:`Browse information objects ` +* :ref:`Create information object ` * :ref:`Read information object ` +* :ref:`Update information object ` +* :ref:`Delete information object ` * :ref:`Download digital object ` .. _api-intro-plugin: @@ -209,7 +212,10 @@ parameters. There are three endpoints available: * :ref:`Browse taxonomy terms ` * :ref:`Browse information objects ` +* :ref:`Create information object ` * :ref:`Read information object ` +* :ref:`Update information object ` +* :ref:`Delete information object ` * :ref:`Download digital objects ` * :ref:`Add physical objects ` diff --git a/dev-manual/api/create-io.rst b/dev-manual/api/create-io.rst new file mode 100644 index 00000000..1b221f59 --- /dev/null +++ b/dev-manual/api/create-io.rst @@ -0,0 +1,62 @@ +.. _api-create-io: + +================================== +Create information object endpoint +================================== + +**POST /api/informationobjects/** + +This endpoint will allow creating an :term:`information object`. + +The following fields can be in the body of the request for the information +object to be created: + + - identifier + - level_of_description_id + - title + - description + - format + - source + - rights + - names + - dates + - notes + - types + - level_of_description + +In addition, it can also accept a ``parent_id`` or a ``parent_slug`` field to +add the new information object as a child of an existing one. + +The newly created information object uses the default publication status +in the settings, unless the user for the given API key does not have the +permissions to publish in which case the publication status will be set +to draft. + +.. _create-io-ex-req: + +Example request +=============== + +.. code-block:: none + + curl -v -X POST http://localhost:63001/api/informationobjects -H 'Content-Type: application/json' -H 'REST-API-Key: 3e136949f7b9b915' -d '{"parent_slug": "example-fonds","title": "Test API Fonds","identifier": "I1","description": "Example description","level_of_description": "Item"}' + +.. _create-io-ex-resp: + +Example response +================ + +Example response is truncated and edited for readability. + +.. code-block:: none + + HTTP/1.1 201 Created + Content-Type: application/json; charset=utf-8 + Transfer-Encoding: chunked + Connection: keep-alive + Cache-Control: private + + {"id": 2004281, "slug": "test-api-fonds", "parent_id": 2004230} + + +:ref:`Back to top ` diff --git a/dev-manual/api/delete-io.rst b/dev-manual/api/delete-io.rst new file mode 100644 index 00000000..9ae1271f --- /dev/null +++ b/dev-manual/api/delete-io.rst @@ -0,0 +1,37 @@ +.. _api-delete-io: + +================================== +Delete information object endpoint +================================== + +**DELETE /api/informationobjects/** + +This endpoint will allow deleting an :term:`information object` for a +given slug. + +.. _delete-io-ex-req: + +Example request +=============== + +.. code-block:: none + + curl -v -X DELETE http://localhost:63001/api/informationobjects/test-description -H 'Content-Type: application/json' -H 'REST-API-Key: 3e136949f7b9b915' + +.. _delete-io-ex-resp: + +Example response +================ + +Example response is truncated and edited for readability. + +.. code-block:: none + + HTTP/1.1 204 No Content + Content-Type: text/html; charset=utf-8 + Transfer-Encoding: chunked + Connection: keep-alive + Cache-Control: private + + +:ref:`Back to top ` diff --git a/dev-manual/api/update-io.rst b/dev-manual/api/update-io.rst new file mode 100644 index 00000000..f0d82612 --- /dev/null +++ b/dev-manual/api/update-io.rst @@ -0,0 +1,55 @@ +.. _api-update-io: + +================================== +Update information object endpoint +================================== + +**PUT /api/informationobjects/** + +This endpoint will allow updating an :term:`information object` for a +given slug. +The following fields are permitted in the body of the request for updates: + + - identifier + - level_of_description_id + - parent_id + - title + - description + - format + - source + - rights + - names + - dates + - notes + - types + - level_of_description + - published + +.. _update-io-ex-req: + +Example request +=============== + +.. code-block:: none + + curl -v -X PUT http://localhost:63001/api/informationobjects/test-description -H 'Content-Type: application/json' -H 'REST-API-Key: 3e136949f7b9b915' -d '{ "title": "New description title" }' + +.. _update-io-ex-resp: + +Example response +================ + +Example response is truncated and edited for readability. + +.. code-block:: none + + HTTP/1.1 200 OK + Content-Type: application/json; charset=utf-8 + Transfer-Encoding: chunked + Connection: keep-alive + Cache-Control: private + + {"id":200430, "parent_id": 1} + + +:ref:`Back to top ` diff --git a/dev-manual/index.rst b/dev-manual/index.rst index 7e0d1d08..41f2e603 100644 --- a/dev-manual/index.rst +++ b/dev-manual/index.rst @@ -14,7 +14,10 @@ set of links to each chapter's main sections. api/api-intro api/browse-taxonomies api/browse-io + api/create-io api/read-io + api/update-io + api/delete-io api/download-do api/add-po diff --git a/index.rst b/index.rst index 12fb853d..9ce7b6c8 100644 --- a/index.rst +++ b/index.rst @@ -282,6 +282,9 @@ sample requests and responses for available endpoints. * :ref:`api-intro` * :ref:`api-browse-taxonomies` * :ref:`api-browse-io` +* :ref:`api-create-io` * :ref:`api-read-io` +* :ref:`api-update-io` +* :ref:`api-delete-io` * :ref:`api-download-do` * :ref:`api-add-po` From 1a019c3b5e7babbc316efe20c2eca774cb548fef Mon Sep 17 00:00:00 2001 From: Anvit Srivastav Date: Fri, 5 Dec 2025 16:14:49 -0800 Subject: [PATCH 2/2] Fix back to top links for api docs --- dev-manual/api/create-io.rst | 2 +- dev-manual/api/delete-io.rst | 2 +- dev-manual/api/update-io.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev-manual/api/create-io.rst b/dev-manual/api/create-io.rst index 1b221f59..d9b56bed 100644 --- a/dev-manual/api/create-io.rst +++ b/dev-manual/api/create-io.rst @@ -59,4 +59,4 @@ Example response is truncated and edited for readability. {"id": 2004281, "slug": "test-api-fonds", "parent_id": 2004230} -:ref:`Back to top ` +:ref:`Back to top ` diff --git a/dev-manual/api/delete-io.rst b/dev-manual/api/delete-io.rst index 9ae1271f..3761af64 100644 --- a/dev-manual/api/delete-io.rst +++ b/dev-manual/api/delete-io.rst @@ -34,4 +34,4 @@ Example response is truncated and edited for readability. Cache-Control: private -:ref:`Back to top ` +:ref:`Back to top ` diff --git a/dev-manual/api/update-io.rst b/dev-manual/api/update-io.rst index f0d82612..6ca5da00 100644 --- a/dev-manual/api/update-io.rst +++ b/dev-manual/api/update-io.rst @@ -52,4 +52,4 @@ Example response is truncated and edited for readability. {"id":200430, "parent_id": 1} -:ref:`Back to top ` +:ref:`Back to top `