Content Service API
Content storage (upload) and retrieval (download) service
Operations
- Content.clear() - Delete all content
- Content.delete() - Delete content
- Content.download() - Download URL for content
- Content.info() - Get information about uploaded content
- Content.list() - List uploaded content
- Content.upload() - Upload URL for content
Operations
clear
Deletes all the content for the given context/solution
Responses
An array of the ids of the deleted content items
Content: [ object ]
Name | Type | Description |
---|---|---|
id | string | The id of the content item |
An error occurred
Content: object Error information
Name | Type | Description |
---|---|---|
type | string | The error message's type |
message | string | The associated error message |
Example
response.message = Content.clear()
delete
Delete the given content item
Arguments
parameters - object - Object containing service call parameters.
Name | Type | Description |
---|---|---|
id | string | The ID of the content |
Responses
The content item was deleted
Content: object The content item id
Name | Type | Description |
---|---|---|
id | string | The id of the content item |
An error occurred
Content: object Error information
Name | Type | Description |
---|---|---|
type | string | The error message's type |
message | string | The associated error message |
Example
response.message = Content.delete({
id = 'image.png',
})
download
Get the download URL for the specified content item
Arguments
parameters - object - Object containing service call parameters.
Name | Type | Description |
---|---|---|
id | string | The ID of the content |
expires_in | string | Time in seconds download URL is valid |
Responses
The download URL
Content: object HTTP information for client-side content downloads
Name | Type | Description |
---|---|---|
id | string | The id of the content item |
url | string | The URL to use |
method | "GET" | The HTTP method to use with this URL |
An error occurred
Content: object Error information
Name | Type | Description |
---|---|---|
type | string | The error message's type |
message | string | The associated error message |
Example
response.message = Content.download({
id = 'image.png',
expires_in = 600,
})
info
Retrieve metadata and tags associated with uploaded content
Arguments
parameters - object - Object containing service call parameters.
Name | Type | Description |
---|---|---|
id | string | The ID of the content |
Responses
The content info
Content: object A content item's metadata and tags
Name | Type | Description |
---|---|---|
id | string | The id of the content item |
tags | object | Tags and their values for the content item |
type | string | The mime type of the content item |
length | integer | The content item's length in bytes |
last_modified | string(dateTime) | Last modified timestamp (formatted as ISO 8601) |
An error occurred
Content: object Error information
Name | Type | Description |
---|---|---|
type | string | The error message's type |
message | string | The associated error message |
Example
response.message = Content.info({
id = 'image.png',
})
list
Get the list of content items for the solution
Arguments
parameters - object - Object containing service call parameters.
Name | Type | Description |
---|---|---|
full | boolean | Return complete content items instead of the id only. |
tags | string | Return complete content items by matching the tags. Without setup op parameter, the default is AND logic. |
op | "AND", "OR" | The operation for tags filters logic. |
Responses
An array of content items
Content: [ object ]
Name | Type | Description |
---|---|---|
id | string | The id of the content item |
tags | object | Tags and their values for the content item |
type | string | The mime type of the content item |
length | integer | The content item's length in bytes |
last_modified | string(dateTime) | Last modified timestamp (formatted as ISO 8601) |
An error occurred
Content: object Error information
Name | Type | Description |
---|---|---|
type | string | The error message's type |
message | string | The associated error message |
Example
response.message = Content.list({
full = true
})
-- or
response.message = Content.list({
tags = to_json({mykey = "myvalue"})
})
-- or
response.message = Content.list({
tags = to_json({mykey = "myvalue", mykey2 = "myvalue2"}),
op = "OR"
})
upload
Get the upload URL for the specified content item. The content ID will be generated if not supplied, and can be generated using the key, if provided
Arguments
parameters - object - Object containing service call parameters.
Name | Type | Description |
---|---|---|
id | string | The ID of the content |
md5 | string | The md5 sum of the content to upload |
type | string | The content's type |
expires_in | string | Time in seconds upload URL is valid |
tags | string | Urlencoded json { "key": "value" } pairs |
Responses
The upload URL
Content: object HTTP information for client-side content uploads
Name | Type | Description |
---|---|---|
id | string | The id of the content item |
url | string | The URL to use |
field | string | The name of the part containing upload data (must be LAST) |
inputs | object | Additional parts expected with the upload |
method | "POST" | The HTTP method to use with this URL |
enctype | string | The expected form-data encoding to use |
An error occurred
Content: object Error information
Name | Type | Description |
---|---|---|
type | string | The error message's type |
message | string | The associated error message |
Example
response.message = Content.upload({
id = 'image.png',
type = 'image/png',
expires_in = 600,
})