Skip to content

Commit d026bca

Browse files
committed
Updated API docs for restricting files
1 parent 353e279 commit d026bca

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ Add a file to an existing Dataset. Description and tags are optional::
211211

212212
A more detailed "add" example using curl::
213213

214-
curl -H "X-Dataverse-key:$API_TOKEN" -X POST -F 'file=@data.tsv' -F 'jsonData={"description":"My description.","categories":["Data"]}' "https://example.dataverse.edu/api/datasets/:persistentId/add?persistentId=$PERSISTENT_ID"
214+
curl -H "X-Dataverse-key:$API_TOKEN" -X POST -F 'file=@data.tsv' -F 'jsonData={"description":"My description.","categories":["Data"], "restrict":"true"}' "https://example.dataverse.edu/api/datasets/:persistentId/add?persistentId=$PERSISTENT_ID"
215215

216216
Example python code to add a file. This may be run by changing these parameters in the sample code:
217217

@@ -302,6 +302,14 @@ Files
302302

303303
.. note:: Please note that files can be added via the native API but the operation is performed on the parent object, which is a dataset. Please see the "Datasets" endpoint above for more information.
304304

305+
Restrict or unrestrict an existing file where ``id`` is the database id of the file to restrict.
306+
307+
PUT http://$SERVER/api/files/{id}/restrict?key=$apiKey
308+
309+
A more detailed "restrict" example using curl::
310+
311+
curl -H "X-Dataverse-key:$API_TOKEN" -X PUT -d true http://$SERVER/api/files/{id}/restrict
312+
305313
Replace an existing file where ``id`` is the database id of the file to replace. Note that metadata such as description and tags are not carried over from the file being replaced::
306314

307315
POST http://$SERVER/api/files/{id}/replace?key=$apiKey

0 commit comments

Comments
 (0)