Static Web Assets management service
Manage and host static web assets in West Connectivity.
- This service helps to manage files as they can be uploaded to a given solution in Connectivity Platform. The aim of this service is also to help to serve files over the solution domain, so user can reach from browser with specified URL.
- This service could be used to create applications using HTML, CSS, and JS files. By storing into a solution as asset they are reachable from browser.
Operations
- Asset.delete() - Delete an existing asset
- Asset.list() - Get information on existing assets
- Asset.send() - Sends a file as response
- Asset.store() - Stores an uploaded file
- Asset.update() - Update file metadata
Operations
Please note that bold arguments are required, while italic arguments are optional.
delete
Deletes an existing asset based on the given path name. Accepts only full path of the asset. Wildcard "*" is not accepted.
Arguments
parameters (object) - Object containing service call parameters.
Name | Type | Description |
---|---|---|
path | string | Path of the asset. Path is case-sensitive. |
Responses
Code | Body Type | Description |
---|---|---|
200 | nil | The object was deleted |
Example
list
Lists existing assets with the given path. "*" can be used as wildcard in the path, for example:
/path/*
: lists all files under /path/*/index.html
: lists all index.html in all folders*
: lists all files
Arguments
parameters (object) - Object containing service call parameters.
Name | Type | Description |
---|---|---|
path | string | Path of the asset. Path is case-sensitive. |
Responses
Code | Body Type | Description |
---|---|---|
200 | [ object ] | List of Files |
Object Parameter of 200 response:
Name | Type | Description |
---|---|---|
md5 | string | MD5 checksum of the stored file |
path | string | Path of the stored file |
size | integer | Size in bytes of the stored file |
mime_type | string | Mime type of the stored file |
Example
send
Sends the given asset as response to a webservice request.
Arguments
parameters (object) - Object containing service call parameters.
Name | Type | Description |
---|---|---|
request_id | string | Request id |
file | string | The path name of the asset that should be sent. |
Responses
Code | Body Type | Description |
---|---|---|
204 | nil | File was sent successfully. |
store
Stores an uploaded file permanently in the asset store under the provided path.
Arguments
parameters (object) - Object containing service call parameters.
Name | Type | Description |
---|---|---|
path | string | Path of the asset. Path is case-sensitive. |
file_id | string | The file_id from the Webservice Request that should be permanently stored. |
request_id | string | The request_id from the Webservice Request that should be permanently stored. |
Responses
Code | Body Type | Description |
---|---|---|
204 | nil | The file was uploaded successfully |
Example
-- In a webservice endpoint script:
if request.files[1] then
return Asset.store({
request_id = request.request_id,
file_id = request.files[1].file_id, path = "/api/location"
})
end
return "no file provided"
update
Update file metadata. Only path can be updated.
Arguments
parameters (object) - Object containing service call parameters.
Name | Type | Description |
---|---|---|
file | string | The path where file is located. Path is case-sensitive |
path | string | The new path to access the file. |
Responses
Code | Body Type | Description |
---|---|---|
204 | nil | File updated |
Service Health Check
Operations
/api/v1/solution/health
Enable the hosting system to check if service is active and running
Arguments
No Content
Responses
Name | Type | Description |
---|---|---|
200 | string | OK |
Errors
No content