Skip to navigation

Quick Start

Make your first Riviera API call in minutes
View as Markdown

In this guide, you’ll create a Dropbox app, configure the required permissions, get an access token, and use the Riviera API to extract metadata from a file.

1. Create a Dropbox app

Head to the Dropbox App Console and click Create app.

  1. Choose Scoped access as the API type.
  2. Select Full Dropbox to give your app access to all files and folders in the user’s Dropbox account.
  3. Name your app and click Create app.

2. Configure permissions

On the Permissions tab of your app’s settings, enable the scopes your app needs:

ScopeDescription
files.metadata.readView information about your Dropbox files and folders
files.content.readView content of your Dropbox files and folders

Click Submit to save your permission changes.

3. Get an access token

For testing, generate a short-lived access token from the Settings tab of your app in the App Console. For production apps, implement the OAuth 2.0 flow.

4. Extract metadata from a file

Use the GetMetadataAsync endpoint to extract file metadata. Thefile_id_or_url parameter accepts a url, path, or file_id. Refer to the File Access Guide for additional details. The following example uses a path that must point to an existing file in your connected Dropbox account.

curl -X POST https://api.dropboxapi.com/2/riviera/get_metadata_async \
--header "Authorization: Bearer YOUR_ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"file_id_or_url": {
".tag": "path",
"path": "/folder/example.png"
}
}'

A successful response contains an async_job_id:

{
".tag": "async_job_id",
"async_job_id": "34g93hh34h04y384084"
}

Save the returned async_job_id for the next request.

5. Check the extraction status

Pass the async_job_id to GetMetadataAsyncCheck to check the status of the operation.

curl -X POST https://api.dropboxapi.com/2/riviera/get_metadata_async/check \
--header "Authorization: Bearer YOUR_ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"async_job_id": "YOUR_ASYNC_JOB_ID"
}'

While the operation is still in progress, poll every 15 seconds until the job completes or fails. If you receive a rate-limited (429) response, honor the Retry-After header before retrying.

When processing is complete, the response contains the extracted metadata:

{
".tag": "complete",
"metadata": {
".tag": "exif",
"image_height": 152,
"image_width": 332,
"megapixels": 0.05
},
"metadata_type": {
".tag": "metadata_type_exif"
}
}

The complete tag indicates that processing has finished. The metadata object contains the metadata extracted from the file.

If processing is still underway, the response returns an in_progress tag:

{
".tag": "in_progress"
}

If processing fails, the response returns a failed tag with details about the error. For example:

{
".tag": "failed",
"failed": {
".tag": "unsupported_format_error"
}
}

Next steps