Downloads API

Controls the creation, polling, and retrieval of user-requested downloads.

Interfaces

Object Synopses

DownloadRequest

  • download_type String

    Required. The type of download

  • info Object

    Optional. Parameters for the download. Currently unused.

DownloadResponse

  • id String

    Unique identifier of the download

  • download_type String

    The type of download

  • user_id String

    The unique identifier of the originating user

  • state String

    The state of the download

  • url String

    The relative URL for the download’s file. Will be null if the fils is in any state but “done”

Show a download's details

GET /api/downloads/:id

Response Codes

  • 200 OK if resource is found
  • 403 Forbidden if the user isn’t the user who created the download or doesn’t have permissions to view the type of the download
  • 404 Not Found if the download doesn’t exist

Example Response

{
  "download": "{API::DownloadResponse}"
}

Create a new download

POST /api/downloads

Response Codes

  • 201 Created if resource is created
  • 403 Forbidden if the user doesn’t have permissions to create the requested download type
  • 422 Unprocessable Entity if resource is not created

Parameters

  • download DownloadRequest Required

    Body parameter. A hash of download parameters.

Example Request

{
  "download": "{API::DownloadRequest}"
}
curl \
  -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"download":"{API::DownloadRequest}"}' \
  http://<bridge>/api/downloads
    

Example Response

{
  "download": "{API::DownloadResponse}"
}

Get the actual file associated with a download

GET /api/downloads/:id/file

Response Codes

  • 302 Found if resource exists
  • 403 Forbidden if the user isn’t the user who created the download or doesn’t have permissions to view the type of the download
  • 404 Not Found if the download doesn’t exist or it hasn’t finished processing