Skip to content

Commit

Permalink
Merge pull request #6653 from pkiraly/6083-documentation-update-nativ…
Browse files Browse the repository at this point in the history
…e-API-examples-reingest-a-file

#6083 update examples in File part of Native API: 'Reingest a File' section
  • Loading branch information
kcondon authored Feb 18, 2020
2 parents fcc5eff + 6d73874 commit 29de8f5
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions doc/sphinx-guides/source/api/native-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1769,11 +1769,39 @@ Reingest a File
Attempt to ingest an existing datafile as tabular data. This API can be used on a file that was not ingested as tabular back when it was uploaded. For example, a Stata v.14 file that was uploaded before ingest support for Stata 14 was added (in Dataverse v.4.9). It can also be used on a file that failed to ingest due to a bug in the ingest plugin that has since been fixed (hence the name "reingest").
Note that this requires "superuser" credentials::
Note that this requires "superuser" credentials.
POST http://$SERVER/api/files/{id}/reingest?key={apiKey}
A curl example using an ``ID``
(``{id}`` is the database id of the file to process)
.. code-block:: bash
export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export SERVER_URL=https://demo.dataverse.org
export ID=24
curl -H "X-Dataverse-key:$API_TOKEN" -X POST $SERVER_URL/api/files/$ID/reingest
The fully expanded example above (without environment variables) looks like this:
.. code-block:: bash
curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X POST https://demo.dataverse.org/api/files/24/reingest
A curl example using a ``PERSISTENT_ID``
.. code-block:: bash
export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export SERVER_URL=https://demo.dataverse.org
export PERSISTENT_ID=doi:10.5072/FK2/AAA000
curl -H "X-Dataverse-key:$API_TOKEN" -X POST $SERVER_URL/api/files/:persistentId/reingest?persistentId=$PERSISTENT_ID
The fully expanded example above (without environment variables) looks like this:
.. code-block:: bash
curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X POST "https://demo.dataverse.org/api/files/:persistentId/reingest?persistentId=doi:10.5072/FK2/AAA000"
Note: at present, the API cannot be used on a file that's already successfully ingested as tabular.
Expand Down

0 comments on commit 29de8f5

Please sign in to comment.