Media Drive
Media Drive is a GraphQL-based API for managing files, folders, and media assets. It supports queries (read operations) and mutations (create, update, delete operations).
| Operation Type | Description |
|---|---|
| Query | Retrieve or list existing media items |
| Mutation | Create, update, move, rename, or delete items |
Prerequisites
Section titled “Prerequisites”- Node.js v19 or later
- A valid account on cloud.unleashlive.com
For a full working sample project, see the Media Drive samples on GitHub.
Endpoint
Section titled “Endpoint”All GraphQL operations are sent as POST requests to:
https://mediadrive-api.unleashlive.com/graphqlAuthentication
Section titled “Authentication”All requests require a Bearer token in the Authorization header. We recommend using a Personal Access Token (PAT). See the Authentication page for how to create one.
Authorization: Bearer <YOUR_PAT>Schema Types
Section titled “Schema Types”Media Drive Item
Section titled “Media Drive Item”The primary resource returned by queries and mutations.
Fields marked with
!are required.
Item Type
Section titled “Item Type”| Key | Description |
|---|---|
I | Image |
V | Video |
M | Model |
R | Report |
FL | Flight log |
D | General document |
U | Undefined type |
Metadata
Section titled “Metadata”Thermal Data
Section titled “Thermal Data”| Field | Type | Description |
|---|---|---|
isThermal | Boolean | Whether the file is thermal |
hasRadiometricData | Boolean | Whether radiometric data exists |
minTemperature | Float | Minimum temperature detected |
maxTemperature | Float | Maximum temperature detected |
calibration | Object | Calibration settings (see Thermal Calibration) |
tmapS3Path | String | S3 path to the thermal map |
Thermal Calibration
Section titled “Thermal Calibration”| Field | Type | Description |
|---|---|---|
emissivity | Float | Emissivity value |
reflectedTemperature | Float | Reflected temperature |
atmosphericTemperature | Float | Atmospheric temperature |
humidity | Float | Humidity |
distance | Float | Distance to subject |
transmissivity | Float | Transmissivity value |
Custom MimeTypes
Section titled “Custom MimeTypes”| Value | Description |
|---|---|
application/vnd.unleashlive.folder | Folder |
application/vnd.unleashlive.folderAggregateArchive | Aggregate archive folder |
application/vnd.unleashlive.folderAggregateResults | Aggregate results folder |
application/vnd.unleashlive.model | Model wrapper |
application/vnd.unleashlive.model.2d | 2D model |
application/vnd.unleashlive.model.3d | 3D model |
application/vnd.unleashlive.model.vr | VR model |
application/vnd.unleashlive.model.pc | Point Cloud model |
Annotations Object
Section titled “Annotations Object”The annotations field is a stringified JSON object keyed by add-on ID.
| Key | Value |
|---|---|
{addonId} | Annotation object (see below) |
Annotation
Section titled “Annotation”| Field | Type | Description |
|---|---|---|
addonId | String | required Add-on identifier |
labels | Object | Label annotations (see Image Labels) |
sessionInfo | Object | Session information (see Session Info) |
Image Labels
Section titled “Image Labels”A map of label objects keyed by label ID.
| Key | Value |
|---|---|
{id} | Label object (see below) |
Session Info
Section titled “Session Info”| Field | Type | Description |
|---|---|---|
title | String | Display title |
value | String or String[] | required Session value |
order | String | Display order |
placeholder | String | Placeholder text |
Queries
Section titled “Queries”Item references below use the LibraryUpdateInput input type, defined as:
input LibraryUpdateInput { id: String!}The inline-object syntax shown in the examples ({ id: "<ITEM_ID>" }) is equivalent to passing a LibraryUpdateInput value. Use the named type when parameterizing queries or mutations with GraphQL variables.
Get Item
Section titled “Get Item”Fetch a single media item by its ID.
Input Parameters
Section titled “Input Parameters”| Parameter | Type | Description |
|---|---|---|
item | LibraryUpdateInput! | required Reference to the item |
Example Response
Section titled “Example Response”For a full working example, see get.js.
List Items
Section titled “List Items”Fetch all child items of a known parent folder. The location parameter is the hierarchy path of the parent, constructed by joining the parent’s location and id with /.
Input Parameters
Section titled “Input Parameters”Pagination
Section titled “Pagination”If there are more items than the specified limit, the response includes a nextToken object. Pass this token to the next request to fetch the following page.
Example Response
Section titled “Example Response”For a full working example, see list.js.
Mutations
Section titled “Mutations”Move Items
Section titled “Move Items”Move one or more items (including all sub-items) to a new parent folder.
mutation MoveItems { move( moveItems: [{ id: "<ITEM_ID>" }] to: { id: "<DESTINATION_FOLDER_ID>" } ) { id parentId location }}Input Parameters
Section titled “Input Parameters”| Parameter | Type | Description |
|---|---|---|
moveItems | [LibraryUpdateInput!] | required Array of item references to move |
to | LibraryUpdateInput! | required Destination folder reference |
Example Response
Section titled “Example Response”{ "data": { "move": [ { "id": "itemId1", "parentId": "itemId11", "location": "teamId1/itemId11" } ] }}For a full working example, see move.js.
Rename Item
Section titled “Rename Item”Rename a single media item.
mutation RenameItems { rename(item: { id: "<ITEM_ID>" }, newName: "New name") { id }}Input Parameters
Section titled “Input Parameters”| Parameter | Type | Description |
|---|---|---|
item | LibraryUpdateInput! | required Reference to the item |
newName | String! | required The new name for the item |
Example Response
Section titled “Example Response”{ "data": { "rename": { "id": "itemId1" } }}For a full working example, see rename.js.
Delete Items
Section titled “Delete Items”Delete one or more items, including all sub-items.
mutation DeleteItems { delete(deleteItems: [{ id: "<ITEM_ID_1>" }, { id: "<ITEM_ID_2>" }]) { deleteItems { id } ownerId }}Input Parameters
Section titled “Input Parameters”| Parameter | Type | Description |
|---|---|---|
deleteItems | [LibraryUpdateInput!] | required Array of item references to delete |
Example Response
Section titled “Example Response”{ "data": { "delete": { "deleteItems": [{ "id": "itemId1" }, { "id": "itemId2" }], "ownerId": "userId1" } }}For a full working example, see delete.js.
File Operations
Section titled “File Operations”Upload
Section titled “Upload”File uploads use the AWS S3 SDK directly, not the GraphQL endpoint. The file is uploaded to the S3 upload bucket with metadata that links it to a Media Drive location.
Upload Metadata
Section titled “Upload Metadata”| Key | Description |
|---|---|
location | Hierarchy path for the upload (e.g. teamId1/folderId1) |
parentId | Parent folder ID (deprecated — use location) |
name | Display name for the media item |
deviceid | Device ID to associate with the item |
For a full working upload example, see upload.js.
Download
Section titled “Download”Files are downloaded from the Media Drive CDN using the item’s s3Path.
CDN Base URL
https://library.unleashlive.comConstruct the download URL by appending the s3Path to the CDN base URL:
https://library.unleashlive.com/<s3Path>- Query or list items to obtain the
s3Pathof the desired file. - Construct the full URL:
https://library.unleashlive.com/{s3Path}. - Perform an HTTPS GET request to download the file.
For a full working download example, see download.js.