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
## Bug fix to Search API. Now includes all type totals (Dataverses, Dataset, and Files) regardless of the list of types requested
2
+
3
+
None requested types were returned with total count set to 0.
4
+
&type=dataverse&type=dataset would result in "Files" : 0 since type=file was not requested
5
+
6
+
Now all counts show the correct totals.
7
+
Note: This is only true for the first page requested. Subsequent pages could have 0 counts and should not be used. This is due to the need for speed. Getting the totals is an additional search call in the background.
Original /restrict API only allowed for a boolean to update the restricted attribute of a file.
4
+
The extended API still allows for the single boolean for backward compatibility.
5
+
This change also allows for a JSON object to be passed which allows for the required `restrict` flag as well as optional attributes: `enableAccessRequest` and `termsOfAccess`.
6
+
If `enableAccessRequest` is false then the `termsOfAccess` text must also be included.
7
+
8
+
See [the guides](https://dataverse-guide--11349.org.readthedocs.build/en/11349/api/native-api.html#restrict-files), #11299, and #11349.
Copy file name to clipboardExpand all lines: doc/sphinx-guides/source/api/native-api.rst
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4039,6 +4039,8 @@ Restrict Files
4039
4039
~~~~~~~~~~~~~~
4040
4040
4041
4041
Restrict or unrestrict an existing file where ``id`` is the database id of the file or ``pid`` is the persistent id (DOI or Handle) of the file to restrict. Note that some Dataverse installations do not allow the ability to restrict files (see :ref:`:PublicInstall`).
4042
+
Restricting or Unrestricting a file, not in a draft version of the Dataset, will result in a new Draft version being created.
4043
+
Optionally the API can receive a JSON string with additional parameters related to the ability to request access to the file and the terms of that access.
4042
4044
4043
4045
A curl example using an ``id``
4044
4046
@@ -4072,6 +4074,33 @@ The fully expanded example above (without environment variables) looks like this
4072
4074
4073
4075
curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT -d true"https://demo.dataverse.org/api/files/:persistentId/restrict?persistentId=doi:10.5072/FK2/AAA000"
curl -H "X-Dataverse-key:$API_TOKEN" -X PUT "$SERVER_URL/api/files/$ID/restrict" \
4086
+
-H "Content-Type: application/json" \
4087
+
-d '{"restrict": true, "enableAccessRequest":false, "termsOfAccess": "Reason for the restricted access"}'
4088
+
4089
+
Note the behavior of the optional parameters:
4090
+
4091
+
- If restrict is falsethen enableAccessRequest and termsOfAccess are ignored
4092
+
- If restrict is true and enableAccessRequest is falsethen termsOfAccess is required. A status of CONFLICT (409) will be returned if the termsOfAccess is missing
4093
+
4094
+
The enableAccessRequest and termsOfAccess are applied to the Draft version of the Dataset and affect all of the restricted files in said Draft version.
4095
+
4096
+
The fully expanded example above (without environment variables) looks like this:
4097
+
4098
+
.. code-block:: bash
4099
+
4100
+
curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT "https://demo.dataverse.org/api/files/:persistentId/restrict?persistentId=doi:10.5072/FK2/AAA000" \
4101
+
-H "Content-Type: application/json" \
4102
+
-d '{"restrict": true, "enableAccessRequest":false, "termsOfAccess": "Reason for the restricted access"}'
.body("data.message", equalTo("File dataverseproject.png restricted. Access Request is disabled. Terms of Access for restricted files: Testing terms of access"))
0 commit comments