Changeset View
Changeset View
Standalone View
Standalone View
docs/getting-started.rst
Show All 13 Lines | |||||
Example: retrieving a directory | Example: retrieving a directory | ||||
------------------------------- | ------------------------------- | ||||
First, ask the Vault to prepare your bundle: | First, ask the Vault to prepare your bundle: | ||||
.. code:: shell | .. code:: shell | ||||
curl -X POST https://archive.softwareheritage.org/api/1/vault/directory/:dir_id/ | curl -X POST https://archive.softwareheritage.org/api/1/vault/flat/:swhid/ | ||||
where ``:dir_id`` is a :py:func:`directory identifier | where ``:swhid`` is a :ref:`persistent-identifier`. This initial request and all | ||||
<swh.model.identifiers.directory_identifier>`. This initial request and all | |||||
subsequent requests to this endpoint will return some JSON data containing | subsequent requests to this endpoint will return some JSON data containing | ||||
information about the progress of bundle creation: | information about the progress of bundle creation: | ||||
.. code:: json | .. code:: json | ||||
{ | { | ||||
"id": 42, | "id": 42, | ||||
"fetch_url": "/api/1/vault/directory/:dir_id/raw/", | "fetch_url": "/api/1/vault/flat/:swhid/raw/", | ||||
"obj_id": ":dir_id", | "swhid": ":swhid", | ||||
"obj_type": "directory", | |||||
"progress_message": "Creating tarball...", | "progress_message": "Creating tarball...", | ||||
"status": "pending" | "status": "pending" | ||||
} | } | ||||
Once the status is ``done``, you can fetch the bundle at the address | Once the status is ``done``, you can fetch the bundle at the address | ||||
given in the ``fetch_url`` field. | given in the ``fetch_url`` field. | ||||
.. code:: shell | .. code:: shell | ||||
curl -o bundle.tar.gz https://archive.softwareheritage.org/api/1/vault/directory/:dir_id/raw | curl -o bundle.tar.gz https://archive.softwareheritage.org/api/1/vault/flat/:swhid/raw | ||||
tar xaf bundle.tar.gz | tar xaf bundle.tar.gz | ||||
E-mail notifications | E-mail notifications | ||||
-------------------- | -------------------- | ||||
You can also ask to be notified by e-mail once the bundle you requested is | You can also ask to be notified by e-mail once the bundle you requested is | ||||
ready, by giving an ``email`` POST parameter: | ready, by giving an ``email`` POST parameter: | ||||
Show All 9 Lines |