Skip to content

Commit

Permalink
document file detection workaround #2202
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed May 15, 2019
1 parent 357c24b commit 9e95ede
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/sphinx-guides/source/api/native-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ A more detailed "add" example using curl::

curl -H "X-Dataverse-key:$API_TOKEN" -X POST -F '[email protected]' -F 'jsonData={"description":"My description.","directoryLabel":"data/subdir1","categories":["Data"], "restrict":"true"}' "https://example.dataverse.edu/api/datasets/:persistentId/add?persistentId=$PERSISTENT_ID"

Please note that it's possible to "trick" Dataverse into giving a file a content type (MIME type) of your choosing. For example, you can make a text file be treated like a video file with ``-F '[email protected];type=video/mpeg4'``, for example. If Dataverse does not properly detect a file type, specifying the content type via API like this a potential workaround.

This comment has been minimized.

Copy link
@mheppler

mheppler May 15, 2019

Contributor

Would it be possible to give a more realistic example here and write it in a way that suggests a "best practice", as opposed to a "trick"...??


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

* ``dataverse_server`` - e.g. https://demo.dataverse.org
Expand Down

0 comments on commit 9e95ede

Please sign in to comment.