You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Edit File Metadata empty values should clear data
2
+
3
+
Previously the API POST /files/{id}/metadata would ignore fields with empty values. Now the API updates the fields with the empty values essentially clearing the data. Missing fields will still be ignored.
4
+
5
+
An optional query parameter (sourceLastUpdateTime) was added to ensure the metadata update doesn't overwrite stale data.
6
+
7
+
See also [the guides](https://dataverse-guide--11359.org.readthedocs.build/en/11359/api/native-api.html#updating-file-metadata), #11392, and #11359.
Copy file name to clipboardExpand all lines: doc/sphinx-guides/source/api/changelog.rst
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,11 @@ This API changelog is experimental and we would love feedback on its usefulness.
7
7
:local:
8
8
:depth: 1
9
9
10
+
v6.8
11
+
----
12
+
- For POST /api/files/{id}/metadata passing an empty string ("description":"") or array ("categories":[]) will no longer be ignored. Empty fields will now clear out the values in the file's metadata. To ignore the fields simply do not include them in the JSON string.
13
+
- For PUT /api/datasets/{id}/editMetadata the query parameter "sourceInternalVersionNumber" has been removed and replaced with "sourceLastUpdateTime" to verify that the data being edited hasn't been modified and isn't stale.
Copy file name to clipboardExpand all lines: doc/sphinx-guides/source/api/native-api.rst
+15-9Lines changed: 15 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1800,6 +1800,8 @@ The returned file counts are based on different criteria:
1800
1800
- Per tabular tag name
1801
1801
- Per access status (Possible values: Public, Restricted, EmbargoedThenRestricted, EmbargoedThenPublic, RetentionPeriodExpired)
1802
1802
1803
+
Note: Authentication is required. This call will return a 403/Forbidden response for Guest users.
1804
+
1803
1805
.. code-block:: bash
1804
1806
1805
1807
export SERVER_URL=https://demo.dataverse.org
@@ -2156,26 +2158,26 @@ For these edits your JSON file need only include those dataset fields which you
2156
2158
2157
2159
This endpoint also allows removing fields, as long as they are not required by the dataset. To remove a field, send an empty value (``""``) for individual fields. For multiple fields, send an empty array (``[]``). A sample JSON file for removing fields may be downloaded here: :download:`dataset-edit-metadata-delete-fields-sample.json <../_static/api/dataset-edit-metadata-delete-fields-sample.json>`
2158
2160
2159
-
If another user updates the dataset version metadata before you send the update request, data inconsistencies may occur. To prevent this, you can use the optional ``sourceInternalVersionNumber`` query parameter. This parameter must include the internal version number corresponding to the dataset version being updated. Note that internal version numbers increase sequentially with each version update.
2161
+
If another user updates the dataset version metadata before you send the update request, metadata inconsistencies may occur. To prevent this, you can use the optional ``sourceLastUpdateTime`` query parameter. This parameter must include the ``lastUpdateTime`` corresponding to the dataset version being updated. The date must be in the format ``yyyy-MM-dd'T'HH:mm:ss'Z'``.
2160
2162
2161
-
If this parameter is provided, the update will proceed only if the internal version number remains unchanged. Otherwise, the request will fail with an error.
2163
+
If this parameter is provided, the update will proceed only if the ``lastUpdateTime`` remains unchanged (meaning no one has updated the dataset metadata since you retrieved it). Otherwise, the request will fail with an error.
Shows the combined size in bytes of all the files available for download from version ``versionId`` of dataset ``id``.
2786
+
Note: Authentication is required. This call will return a 403/Forbidden response for Guest users.
2784
2787
2785
2788
.. code-block:: bash
2786
2789
@@ -4730,6 +4733,8 @@ Updating File Metadata
4730
4733
4731
4734
Updates the file metadata for an existing file where ``ID`` is the database id of the file to update or ``PERSISTENT_ID`` is the persistent id (DOI or Handle) of the file. Requires a ``jsonString`` expressing the new metadata. No metadata from the previous version of this file will be persisted, so if you want to update a specific field first get the json with the above command and alter the fields you want.
4732
4735
4736
+
An optional parameter, sourceLastUpdateTime=datetime (in format: ``yyyy-MM-dd'T'HH:mm:ss'Z'``), can be used to verify that the file metadata being edited has not been changed since you last retrieved it, thereby avoiding potential lost metadata updates. The value forsourceLastUpdateTime can be taken from ``lastUpdateTime``in the response to get $SERVER_URL/api/files/$ID API call.
4737
+
4733
4738
A curl example using an ``ID``
4734
4739
4735
4740
.. code-block:: bash
@@ -4750,25 +4755,26 @@ The fully expanded example above (without environment variables) looks like this
Note: To update the 'tabularTags' property of file metadata, use the 'dataFileTags' key when making API requests. This property is used to update the 'tabularTags' of the file metadata.
0 commit comments