Skip to content

Commit

Permalink
rename "downloadAll" to "dataset" (Data Access API) #4529
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Jul 17, 2020
1 parent 05e55c2 commit 4da877b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions doc/sphinx-guides/source/api/dataaccess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ More advanced features of the Access API include format-specific transformations
.. contents:: |toctitle|
:local:

.. _download-all-api:
.. _download-by-dataset-api:

Downloading All Files in a Dataset
----------------------------------

The "download all" API downloads as many files as possible from a dataset as a zipped bundle.
The "download by dataset" API downloads as many files as possible from a dataset as a zipped bundle.

By default, tabular files are downloaded in their "archival" form (tab-separated values). To download the original files (Stata, for example), add ``format=original`` as a query parameter.

Expand All @@ -25,10 +25,10 @@ In the curl example below, the flags ``-O`` and ``J`` are used. When there are n

Please note that in addition to the files from dataset, an additional file call "MANIFEST.TXT" will be included in the zipped bundle. It has additional information about the files.

There are two forms of the ``downloadAll`` API, a basic form and one that supports dataset versions.
There are two forms of the "download by dataset" API, a basic form and one that supports dataset versions.

Basic Download All
~~~~~~~~~~~~~~~~~~
Basic Download By Dataset
~~~~~~~~~~~~~~~~~~~~~~~~~

The basic form downloads files from the latest accessible version of the dataset. If you are not using an API token, this means the most recently published version. If you are using an API token with full access to the dataset, this means the draft version or the most recently published version if no draft exists.

Expand All @@ -40,18 +40,18 @@ A curl example using a DOI (no version):
export SERVER_URL=https://demo.dataverse.org
export PERSISTENT_ID=doi:10.70122/FK2/N2XGBJ
curl -O -J -H "X-Dataverse-key:$API_TOKEN" $SERVER_URL/api/access/downloadAll/:persistentId/?persistentId=$PERSISTENT_ID
curl -O -J -H "X-Dataverse-key:$API_TOKEN" $SERVER_URL/api/access/dataset/:persistentId/?persistentId=$PERSISTENT_ID
The fully expanded example above (without environment variables) looks like this:

.. code-block:: bash
curl -O -J -H X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx https://demo.dataverse.org/api/access/downloadAll/:persistentId/?persistentId=doi:10.70122/FK2/N2XGBJ
curl -O -J -H X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx https://demo.dataverse.org/api/access/dataset/:persistentId/?persistentId=doi:10.70122/FK2/N2XGBJ
Download All By Version
~~~~~~~~~~~~~~~~~~~~~~~
Download By Dataset By Version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The second form of the ``downloadAll`` API allows you to specify which version you'd like to download files from. As with the ``datasets`` API endpoints described in the :doc:`native-api` section, the following identifiers can be used.
The second form of the "download by dataset" API allows you to specify which version you'd like to download files from. As with the ``datasets`` API endpoints described in the :doc:`native-api` section, the following identifiers can be used.

* ``:draft`` the draft version, if any
* ``:latest`` either a draft (if exists) or the latest published version.
Expand All @@ -68,13 +68,13 @@ A curl example using a DOI (with version):
export PERSISTENT_ID=doi:10.70122/FK2/N2XGBJ
export VERSION=2.0
curl -O -J -H "X-Dataverse-key:$API_TOKEN" $SERVER_URL/api/access/downloadAll/:persistentId/versions/$VERSION?persistentId=$PERSISTENT_ID
curl -O -J -H "X-Dataverse-key:$API_TOKEN" $SERVER_URL/api/access/dataset/:persistentId/versions/$VERSION?persistentId=$PERSISTENT_ID
The fully expanded example above (without environment variables) looks like this:

.. code-block:: bash
curl -O -J -H X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx https://demo.dataverse.org/api/access/downloadAll/:persistentId/versions/2.0?persistentId=doi:10.70122/FK2/N2XGBJ
curl -O -J -H X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx https://demo.dataverse.org/api/access/dataset/:persistentId/versions/2.0?persistentId=doi:10.70122/FK2/N2XGBJ
Basic File Access
-----------------
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx-guides/source/api/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Downloading Files

The :doc:`dataaccess` section explains how to download files.

To download all the files in a dataset, see :ref:`download-all-api`.
To download all the files in a dataset, see :ref:`download-by-dataset-api`.

In order to download individual files, you must know their database IDs which you can get from the ``dataverse_json`` metadata at the dataset level. See :ref:`export-dataset-metadata-api`.

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/api/Access.java
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ public Response postDownloadDatafiles(String fileIds, @QueryParam("gbrecs") bool
return downloadDatafiles(fileIds, gbrecs, apiTokenParam, uriInfo, headers, response);
}

@Path("downloadAll/{id}")
@Path("dataset/{id}")
@GET
@Produces({"application/zip"})
public Response downloadAllFromLatest(@PathParam("id") String datasetIdOrPersistentId, @QueryParam("gbrecs") boolean gbrecs, @QueryParam("key") String apiTokenParam, @Context UriInfo uriInfo, @Context HttpHeaders headers, @Context HttpServletResponse response) throws WebApplicationException {
Expand All @@ -564,7 +564,7 @@ public Response downloadAllFromLatest(@PathParam("id") String datasetIdOrPersist
}
}

@Path("downloadAll/{id}/versions/{versionId}")
@Path("dataset/{id}/versions/{versionId}")
@GET
@Produces({"application/zip"})
public Response downloadAllFromVersion(@PathParam("id") String datasetIdOrPersistentId, @PathParam("versionId") String versionId, @QueryParam("gbrecs") boolean gbrecs, @QueryParam("key") String apiTokenParam, @Context UriInfo uriInfo, @Context HttpHeaders headers, @Context HttpServletResponse response) throws WebApplicationException {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ static Response downloadFiles(String datasetIdOrPersistentId, String datasetVers
optionalFormat = "?format=" + format;
}
}
return requestSpecification.get("/api/access/downloadAll/" + idInPath + optionalVersion + optionalQueryParam + optionalFormat);
return requestSpecification.get("/api/access/dataset/" + idInPath + optionalVersion + optionalQueryParam + optionalFormat);
}

static Response subset(String fileId, String variables, String apiToken) {
Expand Down

0 comments on commit 4da877b

Please sign in to comment.