Asset API

An asset is a resource that each device will need in order to accurately depict objects around it. This can vary, from an .obj file, containing mesh information, to a .glsl file, containing shader information, to a .png or .jpg file containing an image. Assets can either be associated to a Scene or an Object, or anything else by Asset Relationships.

A Scene Asset is a file that devices may need to utilize in order to synchronize views of scenes with other devices, such as a photograph of a specified object or marker. It can also include map/level mesh and shader information, for use with VR/traditional video games. This API allows for the storage and retrieval of such files.

An Object Asset is a file that is used to construct an Object. Entire collections of assets are expected to be downloaded for each object, and so registering to a scene is expected to incur a large set of downloads to collect all of the assets within that scene.

When authentication is active, assets are associated to the user that creates them and can be public or private. Users can only interact with assets that are either public, or that they own.

Asset Creation

POST /v1/asset/

Create a new asset from the File Data in the body of the request. If the ‘related-id’ and ‘related-type’ are also populated, then an Asset Relationship is created as well.

Query Parameters:
 
  • content-type (string) – Optional. The content type of the asset (ie. application/json).
  • file-type (string) – Optional. The file type of the asset (ie. json).
  • related-id (string) – Optional. Must appear with ‘related-type’. Used to create a relationship to the specified object.
  • related-type (string) – Optional. Must appear with ‘related-id’. Used the create a relationship of the specified type.
  • asset-type (string) – Optional. Populated into the query-able Asset Metadata.
  • isPublic (boolean) – Optional. Is the asset public or proviate
Request Headers:
 
Status Codes:

http

POST /v1/asset HTTP/1.1
Host: localhost:8080
Content-Type: multipart/form-data

"file=@testupload.txt"

curl

curl -i -X POST http://localhost:8080/v1/asset -H 'Content-Type: multipart/form-data' --data-raw '"file=@testupload.txt"'

response

HTTP/1.1 200 OK
Location: http://localhost:8080/v1/asset
Content-Type: text/plain

abcdef

Asset Update

POST /v1/asset/{asset_key}

Update an existing Asset. This returns a new key for the asset, and adds an entry to the associated Asset History. This will also update all relationships which were associated to the old Asset, and associate them to the new Asset.

Query Parameters:
 
  • content-type (string) – Optional. The content type of the asset (ie. application/json).
  • file-type (string) – Optional. The file type of the asset (ie. json).
  • asset-type (string) – Optional. Populated into the query-able Asset Metadata.
Request Headers:
 
Status Codes:

http

POST /v1/asset/key HTTP/1.1
Host: localhost:8080
Content-Type: multipart/form-data

"file=@testupload.txt"

curl

curl -i -X POST http://localhost:8080/v1/asset/key -H 'Content-Type: multipart/form-data' --data-raw '"file=@testupload.txt"'

response

HTTP/1.1 200 OK
Location: http://localhost:8080/v1/asset
Content-Type: text/plain

abcdef

Asset Retrieval

GET /v1/asset/(asset_key)

Retrieve an asset by ID.

Status Codes:

http

GET /v1/asset/key HTTP/1.1
Host: localhost:8080

curl

curl -i http://localhost:8080/v1/asset/key

Asset Count

GET /v1/asset/count

Count the total number of assets matching the given query.

Query Parameters:
 
  • content-type (string) – Optional. The content type of the asset (ie. application/json).
  • file-type (string) – Optional. The file type of the asset (ie. json).
  • asset-type (string) – Optional. Valid options are ‘standard’ (for normal assets), and ‘thumbnail’ for thumbnail assets.
Status Codes:

http

GET /v1/asset/count?file-type=obj HTTP/1.1
Host: localhost:8080

curl

curl -i 'http://localhost:8080/v1/asset/count?file-type=obj'

Asset Metadata Query

GET /v1/asset

Query Asset Metadata based on various attributes.

Query Parameters:
 
  • content-type (string) – Optional. The content type of the asset (ie. application/json).
  • file-type (string) – Optional. The file type of the asset (ie. json).
  • asset-type (string) – Optional. Valid options are ‘standard’ (for normal assets), and ‘thumbnail’ for thumbnail assets.
  • limit – Optional. The maximum number of records to return.
  • offset – Optional. The number of records to skip, enabling pagination with the ‘limit’ parameter.
Status Codes:

http

GET /v1/asset?file-type=obj HTTP/1.1
Host: localhost:8080

curl

curl -i 'http://localhost:8080/v1/asset?file-type=obj'

Asset Metadata Batch Query

POST /v1/bulk/asset

Get Asset Metadata by IDs in bulk.

Request Headers:
 
Status Codes:

Asset Deletion

DELETE /v1/asset/(asset_key)

Delete an asset.

Status Codes:

http

DELETE /v1/asset/key HTTP/1.1
Host: localhost:8080

curl

curl -i -X DELETE http://localhost:8080/v1/asset/key

Asset History Retrieval

GET /v1/asset/(asset_key)

An Asset History is a record of all the versions of a particular asset.

Status Codes:

http

GET /v1/asset-history/key HTTP/1.1
Host: localhost:8080

curl

curl -i http://localhost:8080/v1/asset-history/key

response

HTTP/1.1 200 OK
Location: http://localhost:8080/v1/asset-history/key
Content-Type: application/json

[{
    "id": "5ab878ca98afd7729e928dd5",
    "scene": "testScene",
    "object": "testObject",
    "asset": "5ab878c998afd7729e928dd3",
    "assetIds": [
        "5ab878c998afd7729e928dd3",
        "5ab878b098afd7729e928dd1"
    ]
}]