Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions dev-manual/api/api-intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ There are several endpoints available:

* :ref:`Browse taxonomy terms <api-browse-taxonomies>`
* :ref:`Browse information objects <api-browse-io>`
* :ref:`Create information object <api-create-io>`
* :ref:`Read information object <api-read-io>`
* :ref:`Update information object <api-update-io>`
* :ref:`Delete information object <api-delete-io>`
* :ref:`Download digital object <api-download-do>`

.. _api-intro-plugin:
Expand Down Expand Up @@ -209,7 +212,10 @@ parameters. There are three endpoints available:

* :ref:`Browse taxonomy terms <api-browse-taxonomies>`
* :ref:`Browse information objects <api-browse-io>`
* :ref:`Create information object <api-create-io>`
* :ref:`Read information object <api-read-io>`
* :ref:`Update information object <api-update-io>`
* :ref:`Delete information object <api-delete-io>`
* :ref:`Download digital objects <api-download-do>`
* :ref:`Add physical objects <api-add-po>`

Expand Down
62 changes: 62 additions & 0 deletions dev-manual/api/create-io.rst
Original file line number Diff line number Diff line change
@@ -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 <api-create-io>`
37 changes: 37 additions & 0 deletions dev-manual/api/delete-io.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.. _api-delete-io:

==================================
Delete information object endpoint
==================================

**DELETE /api/informationobjects/<slug>**

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 <api-delete-io>`
55 changes: 55 additions & 0 deletions dev-manual/api/update-io.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.. _api-update-io:

==================================
Update information object endpoint
==================================

**PUT /api/informationobjects/<slug>**

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 <api-update-io>`
3 changes: 3 additions & 0 deletions dev-manual/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Loading