Skip to content

Commit d9d3357

Browse files
authored
Merge pull request #11334 from IQSS/11068-api-guide
API Guide: don't interleave "Dataset Version Notes" with "Dataset Types"
2 parents 1557cca + 3aa1969 commit d9d3357

File tree

1 file changed

+32
-33
lines changed

1 file changed

+32
-33
lines changed

doc/sphinx-guides/source/api/native-api.rst

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3613,8 +3613,38 @@ The fully expanded example above (without environment variables) looks like this
36133613
.. code-block:: bash
36143614
36153615
curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X DELETE "https://demo.dataverse.org/api/datasets/datasetTypes/3"
3616-
3617-
.. _api-dataset-version-note:
3616+
3617+
.. _api-link-dataset-type:
3618+
3619+
Link Dataset Type with Metadata Blocks
3620+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3621+
3622+
Linking a dataset type with one or more metadata blocks results in additional fields from those blocks appearing in the output from the :ref:`list-metadata-blocks-for-a-collection` API endpoint. The new frontend for Dataverse (https://github.com/IQSS/dataverse-frontend) uses the JSON output from this API endpoint to construct the page that users see when creating or editing a dataset. Once the frontend has been updated to pass in the dataset type (https://github.com/IQSS/dataverse-client-javascript/issues/210), specifying a dataset type in this way can be an alternative way to display additional metadata fields than the traditional method, which is to enable a metadata block at the collection level (see :ref:`define-metadata-blocks-for-a-dataverse-collection`).
3623+
3624+
For example, a superuser could create a type called "software" and link it to the "CodeMeta" metadata block (this example is below). Then, once the new frontend allows it, the user can specify that they want to create a dataset of type software and see the additional metadata fields from the CodeMeta block when creating or editing their dataset.
3625+
3626+
This API endpoint is for superusers only.
3627+
3628+
.. code-block:: bash
3629+
3630+
export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
3631+
export SERVER_URL=https://demo.dataverse.org
3632+
export TYPE=software
3633+
export JSON='["codeMeta20"]'
3634+
3635+
curl -H "X-Dataverse-key:$API_TOKEN" -H "Content-Type: application/json" "$SERVER_URL/api/datasets/datasetTypes/$TYPE" -X PUT -d $JSON
3636+
3637+
The fully expanded example above (without environment variables) looks like this:
3638+
3639+
.. code-block:: bash
3640+
3641+
curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -H "Content-Type: application/json" "https://demo.dataverse.org/api/datasets/datasetTypes/software" -X PUT -d '["codeMeta20"]'
3642+
3643+
To update the blocks that are linked, send an array with those blocks.
3644+
3645+
To remove all links to blocks, send an empty array.
3646+
3647+
.. _api-dataset-version-note:
36183648
36193649
Dataset Version Notes
36203650
~~~~~~~~~~~~~~~~~~~~~
@@ -3675,37 +3705,6 @@ The fully expanded example above (without environment variables) looks like this
36753705
36763706
curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X DELETE "https://demo.dataverse.org/api/datasets/3/versions/2.0/versionNote"
36773707
3678-
3679-
.. _api-link-dataset-type:
3680-
3681-
Link Dataset Type with Metadata Blocks
3682-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3683-
3684-
Linking a dataset type with one or more metadata blocks results in additional fields from those blocks appearing in the output from the :ref:`list-metadata-blocks-for-a-collection` API endpoint. The new frontend for Dataverse (https://github.com/IQSS/dataverse-frontend) uses the JSON output from this API endpoint to construct the page that users see when creating or editing a dataset. Once the frontend has been updated to pass in the dataset type (https://github.com/IQSS/dataverse-client-javascript/issues/210), specifying a dataset type in this way can be an alternative way to display additional metadata fields than the traditional method, which is to enable a metadata block at the collection level (see :ref:`define-metadata-blocks-for-a-dataverse-collection`).
3685-
3686-
For example, a superuser could create a type called "software" and link it to the "CodeMeta" metadata block (this example is below). Then, once the new frontend allows it, the user can specify that they want to create a dataset of type software and see the additional metadata fields from the CodeMeta block when creating or editing their dataset.
3687-
3688-
This API endpoint is for superusers only.
3689-
3690-
.. code-block:: bash
3691-
3692-
export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
3693-
export SERVER_URL=https://demo.dataverse.org
3694-
export TYPE=software
3695-
export JSON='["codeMeta20"]'
3696-
3697-
curl -H "X-Dataverse-key:$API_TOKEN" -H "Content-Type: application/json" "$SERVER_URL/api/datasets/datasetTypes/$TYPE" -X PUT -d $JSON
3698-
3699-
The fully expanded example above (without environment variables) looks like this:
3700-
3701-
.. code-block:: bash
3702-
3703-
curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -H "Content-Type: application/json" "https://demo.dataverse.org/api/datasets/datasetTypes/software" -X PUT -d '["codeMeta20"]'
3704-
3705-
To update the blocks that are linked, send an array with those blocks.
3706-
3707-
To remove all links to blocks, send an empty array.
3708-
37093708
Delete Files from a Dataset
37103709
~~~~~~~~~~~~~~~~~~~~~~~~~~~
37113710

0 commit comments

Comments
 (0)