Metadata
ENDPOINT
/api/v0-file/metadata/[digest]
(GET only)This endpoint responds with the file metadata and a URL to download the file.
Haplo uses the file’s cryptographic digest to identify the file. The optional fileSize
parameter allows the file size to be specified as additional confirmation of the file identity.
Response
Kind | Meaning | HTTP status |
haplo:api-v0:file:metadata |
The request was successful and the file metadata is returned | 200 |
The response contains the file
property with the file metadata:
- digest
- fileSize
- mimeType
- filename
- createdAt
- properties
- tags
See the File
interface for the meaning of these properties.
The response also contains a download
property with information on how to download the file:
- url
- validUntil
The download URL is signed, does not need authentication, and is valid for a few hours. Treat the URL as opaque and do not attempt to parse it.
Example response
The request:
GET /api/v0-file/metadata/0f324aae890c8293ab55715dc98ccf32fa7b428b1cbdcf71e50f94f0c4f1c061?fileSize=58382
may return the response:
{ "success": true, "kind": "haplo:api-v0:file:metadata", "file": { "digest": "0f324aae890c8293ab55715dc98ccf32fa7b428b1cbdcf71e50f94f0c4f1c061", "fileSize": 58382, "mimeType": "image/png", "filename": "figure_1.png", "createdAt": "2020-05-25T13:57:57.769Z", "properties": { "dimensions": { "width": 600, "height": 656, "units": "px" }, "numberOfPages": 1, "thumbnail": { "width": 175, "height": 192, "mimeType": "image/png" } }, "tags": { "example:reviewed": "t" } }, "download": { "url": "https://app.example.org/file/e91b5e986699e85157b0de35e6b72917f73...", "validUntil": "2020-06-19T10:40:03.815Z" } }