Assets allow you to store content like images, web pages, pdfs etc, and associate them with individual sensors or the whole application. For example, you could create an asset that contains the map of a store and associate it with the sensor inside the store.
Asset types
There are two types of assets supported
- File
- Redirect-URL
File Asset
A File
asset contains the contents of a file that was used to create it. When creating a File
asset, a Content-Type
must be specified which is then used as the HTTP Content-Type
header when retrieving the asset.
Redirect-URL Asset
A Redirect-URL
asset is simple a link to another web URL, and when retrieving a Redirect-URL
asset, the server return a HTTP 301 code with the link as the redirect. To create an Redirect-URL
asset, set the content_type' field to
text/x-redirect-url`
Collections
Assets are organized in Collections
. A Collection
can be thought of as a label on assets, and is used to classify and retrieve a group of assets. Collections
can be setup for the whole application and also at each sensor. For example, you could create a Collection
called Sales
and store PDFs containing sales for the whole country. Then, you could add a Collection
called DailySpecials
on specific sensor in a store that contained assets for daily specials for that store.
Collection
names are restricted to URL safe characters (a-zA-Z0-9_-~). The system also will create a Collection
called default
and add all assets to it.
Data Types
Asset
object consists of the following fields:
- id: Unique id of the asset
- content_type: Content/Mime-Type of the asset
- size: Size in bytes
- content_url: Link to download the contents of the asset. The API will generate this link when you first upload the asset.
- metadata: Metadata associated with this asset.
- created_on: Date the asset was created
- modified_on: Date the asset was last modified.
e.g.
{
"id": "d3d81d22-6e08-4a30-a022-f4404fdfc417",
"created_on": "2014-11-07T18:39:35.615Z",
"modified_on": "2014-11-07T18:39:35.615Z",
"content_type": "application/javascript",
"size": 21,
"metadata": {"default": {"name": "Test Json"}},
"content_url": "https://api.lumenpath.com/api/asset/c0eb26da-f39e-4211-9964-095d020dfe7b/asset/d3d81d22-6e08-4a30-a022-f4404fdfc417/content/"
}```