Skip to content
On this page

Resource upload API

EndpointMethodDescription
/api/v0/resource/upload/linkwebRequestDirect upload to Google bucket (get upload link)
/api/v0/resource/upload/link/completewebRequestDirect upload to Google bucket (complete upload link)
/api/v0/resource/upload/thumbnail/linkwebRequestDirect thumbnail upload to Google bucket (get upload link)
/api/v0/resource/upload/thumbnail/link/completewebRequestDirect thumbnail upload to Google bucket (complete upload link)
/api/v0/resource/upload/remote/urlwebRequestRemote url upload
/api/v0/resource/upload/remote/imagewebRequestRemote image upload
resource:getUploadLinkwebsocketDirect upload (websocket)
resource:completeUploadLinkwebsocketComplete direct upload (websocket)
resource:getUploadLinkForThumbnailwebsocketDirect upload of thumbnail (websocket)
resource:completeUploadLinkForThumbnailwebsocketComplete direct upload of thumbnail (websocket)
resource:createAndSubscribeToUploadSessionwebsocketCreate and subscribe to upload session
resource:resubscribeToUploadSessionwebsocketResubscribe to upload session

HTTP Method: POST

Path: /api/v0/resource/upload/link

Description: Direct upload gives possibility to upload files directly from a client to a storage bucket. It consist of next steps:

  1. Client asks the server for upload link. The server initializes an upload session and returns a link which could be used for upload.

  2. Client uploads a file to Google bucket.

  3. Client sends upload complete acknowledgment to the server.

Headers:

X-Session-Id: sessionToken

X-Resource-Id: resourceId

Request:

{ empty }

Response:

Google bucket upload link

HTTP Method: POST

Path: /api/v0/resource/upload/link/complete

Description: See direct upload to Google bucket.

Headers:

X-Session-Id: sessionToken

X-Resource-Id: resourceId

Request:

{ empty }

Response:

{ empty }

HTTP Method: POST

Path: /api/v0/resource/upload/thumbnail/link

Description: The process is the same as direct upload to Google bucket. Complete with thumbnail uploaded acknowledgment.

Headers:

X-Session-Id: sessionToken

X-Resource-Id: resourceId

Request:

{ empty }

Response:

Google bucket upload link

HTTP Method: POST

Path: /api/v0/resource/upload/thumbnail/link/complete

Description: See direct thumbnail upload to Google bucket.

Headers:

X-Session-Id: sessionToken

X-Resource-Id: resourceId

Request:

{ empty }

Response:

{ empty }

Remote url upload

HTTP Method: POST

Path: /api/v0/resource/upload/remote/url

Description: Endpoint creates resource from remote url.

Resource field metadata.link will keep original url.

Resource field metadata.contentType will be one of: roomful#url, remote#image, remote#audio or remote#video.

Request:

{
    "url": string
    "urlType": string  // Hls/Dash
    "parent": string  // mark that resource belongs to directory
    "roomId": string  // mark that resource belongs to room
    "contributeToRoom": string  // mark that resource belongs to room sorting table
    "addToSortingTable": bool  // mark that resource belongs to user sorting table
    "belonging": string  // use custom belonging (like 'userAIGeneration:{userId}')
}

Response:

{
    "id": string
    "created": timestamp
    "updated": timestamp
    "title": string
    "description": string
    "location": string
    "date": string
    "category": string
    "linkId": string  // id of resource link is pointing to
    "linkType": string  // global/local
    "encryptionVersion": string  // encryption version, like 'verus.v1'
    "encryptionEpoch": int  // epoch defines key bundle that was used for encryption
    "encryptionEpk": string  // ephemeral public key that should be used to decrypt cypher data
    "belonging": string  // determines resource location in the system in a way 'belongingType:belongingPath(networkId)'
    "status": string  // pending/processing/ready/failed
    "metadata": {
        "fileName": string
        "fileSize": int
        "fileDate": timestamp
        "behaviourType": string
        "contentType": string
        "convertedFrom": string
        "link": string
        "origin": { resource origin structure }
        "geolocation": { geolocation structure }
        "dimensions": { dimensions structure }
    }
    "thumbnail": string
    "fromTemplate": bool
    "totalReactions": int  // amount of users who reacted to the resource
    "data": {
        "audio": { resource data audio structure }
        "video": { resource data video structure }
        "amazon": { resource data amazon structure }
        "imdb": { resource data imdb structure }
        "youtube": { resource data youtube structure }
        "pinterest": { resource data pinterest structure }
        "pixabay": { resource data pixabay structure }
        "facebook": { resource data facebook structure }
        "remoteUrl": { resource data remote url structure }
        "liveStream": { live stream data structure }
        "aiGeneration": { ai generation data structure }
        "thumbnailUrl": string
        "downloadUrl": string
        "directory": { resource data directory structure }
        "channel": { channel data structure }
        "googleDrive": { google drive structure }
    }
    "customParams": map[string]{ custom structure }  // client defined parameters
    "actions": [{ programmatic action with children structure }]  // custom programmatic actions from users
}

Remote image upload

HTTP Method: POST

Path: /api/v0/resource/upload/remote/image

Request:

{
    "url": string
    "title": string
    "source": string
    "sourceId": string
    "sourceLink": string
    "parent": string  // mark that resource belongs to directory
    "roomId": string  // mark that resource belongs to room
    "contributeToRoom": string  // mark that resource belongs to room sorting table
    "addToSortingTable": bool  // mark that resource belongs to user sorting table
    "belonging": string  // use custom belonging (like 'userAIGeneration:{userId}')
}

Response:

{
    "id": string
    "created": timestamp
    "updated": timestamp
    "title": string
    "description": string
    "location": string
    "date": string
    "category": string
    "linkId": string  // id of resource link is pointing to
    "linkType": string  // global/local
    "encryptionVersion": string  // encryption version, like 'verus.v1'
    "encryptionEpoch": int  // epoch defines key bundle that was used for encryption
    "encryptionEpk": string  // ephemeral public key that should be used to decrypt cypher data
    "belonging": string  // determines resource location in the system in a way 'belongingType:belongingPath(networkId)'
    "status": string  // pending/processing/ready/failed
    "metadata": {
        "fileName": string
        "fileSize": int
        "fileDate": timestamp
        "behaviourType": string
        "contentType": string
        "convertedFrom": string
        "link": string
        "origin": { resource origin structure }
        "geolocation": { geolocation structure }
        "dimensions": { dimensions structure }
    }
    "thumbnail": string
    "fromTemplate": bool
    "totalReactions": int  // amount of users who reacted to the resource
    "data": {
        "audio": { resource data audio structure }
        "video": { resource data video structure }
        "amazon": { resource data amazon structure }
        "imdb": { resource data imdb structure }
        "youtube": { resource data youtube structure }
        "pinterest": { resource data pinterest structure }
        "pixabay": { resource data pixabay structure }
        "facebook": { resource data facebook structure }
        "remoteUrl": { resource data remote url structure }
        "liveStream": { live stream data structure }
        "aiGeneration": { ai generation data structure }
        "thumbnailUrl": string
        "downloadUrl": string
        "directory": { resource data directory structure }
        "channel": { channel data structure }
        "googleDrive": { google drive structure }
    }
    "customParams": map[string]{ custom structure }  // client defined parameters
    "actions": [{ programmatic action with children structure }]  // custom programmatic actions from users
}

Direct upload (websocket)

Method: websocket

Endpoint: resource:getUploadLink

Description: Get link for direct upload to Google bucket. Upload process consist of the following steps:

  1. Client asks the server for upload link. The server initializes an upload session and returns a link which would be used for upload.

  2. Client uploads a file to Google bucket.

  3. Client sends upload complete acknowledgment to the server.

Request:

{
    "data": {
        "resourceId": string
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "data": {
        "url": string
    }
    "error": { "status": bool, "code": int, "message": string }
}

Complete direct upload (websocket)

Method: websocket

Endpoint: resource:completeUploadLink

Description: See direct upload.

Request:

{
    "data": {
        "resourceId": string
        "thumbnailSize": int  // in case if uploading thumbnail
        "encryption": {  // in case if resource is encrypted, provide encryption details here
            "encryptionVersion": string  // encryption version, like 'verus.v1'
            "encryptionEpoch": int  // epoch defines key bundle that was used for encryption
            "encryptionEpk": string  // ephemeral public key that should be used to decrypt cypher data
        }
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "data": {
        "resource": { resource structure }
    }
    "error": { "status": bool, "code": int, "message": string }
}

Direct upload of thumbnail (websocket)

Method: websocket

Endpoint: resource:getUploadLinkForThumbnail

Description: The process is the same as direct upload.

Complete with direct upload acknowledgment.

Request:

{
    "data": {
        "resourceId": string
        "thumbnailSize": int
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "data": {
        "url": string
    }
    "error": { "status": bool, "code": int, "message": string }
}

Complete direct upload of thumbnail (websocket)

Method: websocket

Endpoint: resource:completeUploadLinkForThumbnail

Description: See direct upload.

Request:

{
    "data": {
        "resourceId": string
        "thumbnailSize": int  // in case if uploading thumbnail
        "encryption": {  // in case if resource is encrypted, provide encryption details here
            "encryptionVersion": string  // encryption version, like 'verus.v1'
            "encryptionEpoch": int  // epoch defines key bundle that was used for encryption
            "encryptionEpk": string  // ephemeral public key that should be used to decrypt cypher data
        }
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "data": {
        "resource": { resource structure }
    }
    "error": { "status": bool, "code": int, "message": string }
}

Create and subscribe to upload session

Method: websocket

Endpoint: resource:createAndSubscribeToUploadSession

Description: API creates new resource(s) upload session and subscribes user socket to it.

Request:

{ empty }

Response:

{
    "data": {
        "uploadSessionId": string
        "belonging": string
    }
    "error": { "status": bool, "code": int, "message": string }
}

Resubscribe to upload session

Method: websocket

Endpoint: resource:resubscribeToUploadSession

Description: API resubscribes user socket to resource(s) upload session.

Request:

{
    "data": {
        "uploadSessionId": string
    }
    "event": { "id": string, "date": timestamp }
}

Response:

{
    "data": {
        "uploadSessionId": string
        "belonging": string
    }
    "error": { "status": bool, "code": int, "message": string }
}

Models


Resource Origin

{
    "type": string
    "device": string
    "deviceName": string
    "path": string
}

Geolocation

{
    "latitude": float
    "longitude": float
}

Dimensions

{
    "width": int
    "height": int
    "orientation": int
}

Resource Data Audio

{
    "title": string
    "artist": string
    "album": string
    "genre": string
    "duration": int
    "durationFloat": float
}

Resource Data Video

{
    "duration": int
    "durationFloat": float
    "hasAlphaChannel": bool  // true, if video generated from gif with transparent pixels
    "alphaChannel": string  // alpha channel video resource (if generated from gif)
}

Resource Data Amazon

{
    "asin": string
    "summary": string
    "author": [ string ]
    "manufacturer": string
    "title": string
    "publicationDate": string
    "url": string
}

Resource Data Imdb

{
    "Actors": string
    "Genre": string
    "Ratings": [{
        "Source": string
        "Value": string
    }]
    "Released": string
    "Runtime": string
    "Website": string
    "Year": string
    "Trailers": [ string ]
    "imdbID": string
}

Resource Data Youtube

{
    "videoId": string
    "formatId": string
}

Resource Data Pinterest

{
    "pin": string
    "url": string
}

Resource Data Pixabay

{
    "id": string
    "pageUrl": string
}

Resource Data Facebook

{
    "id": string
}

Resource Data Remote Url

{
    "url": string
    "urlType": string
    "favicon": string
    "title": string
}

Live Stream Data

{
    "streamId": string
    "assetId": string
    "playbackUrl": string
    "masterUrl": string
}

AI Generation Data

{
    "generationModel": string  // the model used for image generation [dall-e-3]
    "prompt": string  // a text description of the desired image
    "revisedPrompt": string  // the prompt that was used to generate the image, if there was any revision to the prompt
    "url": string  // the URL of the generated image
}

Resource Data Directory

{
    "innerContentType": string
    "innerContentCount": int
}

Channel Data

{
    "communityId": string
    "channelId": string
    "subChannelId": string
    "messageId": string
}

Google Drive

{
    "fileId": string
    "name": string
    "mimeType": string
}

Programmatic Action with children

{
    "localId": string  // local action id, operated by client side only
    "eventName": string
    "actionName": string
    "actionData": {
        "usedPropId": string
        "usedRoomId": string
        "usedNetworkId": string
        "usedStorylineId": string
        "usedQuestionId": int
        "usedQuestionnaireId": int
        "usedSegmentId": string
        "usedPlacementAreaId": string
        "usedRoomPoint": string
        "animationData": map[string]{ custom structure }
    }
    "childActions": [{ programmatic action structure }]
}

Programmatic Action

{
    "localId": string  // local action id, operated by client side only
    "eventName": string
    "actionName": string
    "actionData": {
        "usedPropId": string
        "usedRoomId": string
        "usedNetworkId": string
        "usedStorylineId": string
        "usedQuestionId": int
        "usedQuestionnaireId": int
        "usedSegmentId": string
        "usedPlacementAreaId": string
        "usedRoomPoint": string
        "animationData": map[string]{ custom structure }
    }
}

Resource

{
    "id": string
    "created": timestamp
    "updated": timestamp
    "title": string
    "description": string
    "location": string
    "date": string
    "category": string
    "linkId": string  // id of resource link is pointing to
    "linkType": string  // global/local
    "encryptionVersion": string  // encryption version, like 'verus.v1'
    "encryptionEpoch": int  // epoch defines key bundle that was used for encryption
    "encryptionEpk": string  // ephemeral public key that should be used to decrypt cypher data
    "belonging": string  // determines resource location in the system in a way 'belongingType:belongingPath(networkId)'
    "status": string  // pending/processing/ready/failed
    "metadata": {
        "fileName": string
        "fileSize": int
        "fileDate": timestamp
        "behaviourType": string
        "contentType": string
        "convertedFrom": string
        "link": string
        "origin": { resource origin structure }
        "geolocation": { geolocation structure }
        "dimensions": { dimensions structure }
    }
    "thumbnail": string
    "fromTemplate": bool
    "totalReactions": int  // amount of users who reacted to the resource
    "data": {
        "audio": { resource data audio structure }
        "video": { resource data video structure }
        "amazon": { resource data amazon structure }
        "imdb": { resource data imdb structure }
        "youtube": { resource data youtube structure }
        "pinterest": { resource data pinterest structure }
        "pixabay": { resource data pixabay structure }
        "facebook": { resource data facebook structure }
        "remoteUrl": { resource data remote url structure }
        "liveStream": { live stream data structure }
        "aiGeneration": { ai generation data structure }
        "thumbnailUrl": string
        "downloadUrl": string
        "directory": { resource data directory structure }
        "channel": { channel data structure }
        "googleDrive": { google drive structure }
    }
    "customParams": map[string]{ custom structure }  // client defined parameters
    "actions": [{ programmatic action with children structure }]  // custom programmatic actions from users
}