Test Assets API


The test assets API manages Errthquake asset files. Assets can be uploaded, downloaded, and deleted, and asset metadata can be queried.

Permissions

Managing CSV input files and test object files requires the View Test Inputs permission. Managing YAML test configurations requires the View Test Configs permission.

APIs

Assets List API

https://api.errthquake.com/assets/<workspace-uid>

GET returns

{
  "workspace-uid": <string: workspace uuid>,
  "assets": map{ <string: filename">, asset-metadata-document }
}

The assets map contains metadata for all test assets in the workspace.

POST submits a multipart form with content and metadata parts

Content-Type header value multipart/form-data; boundary=<unique boundary identifier>

content part

text or binary file content

metadata part

{
  "asset-type": <string: asset type, "configuration", "inputset", or "object">
}

POST returns

{
  "workspace-uid": <string: workspace uuid>,
  "assets": map{ <string: filename">, asset-metadata-document }
}

The assets map contains metadata for the successfully uploaded file.

CURL example: CSV input asset post:

curl -X POST -H "Authorization: <authorization value>" \
  https://api.errthquake.com/assets/<workspace uuid> \
  -F "metadata={\"asset-type\":\"inputset\"};type=application/json" \
  -F "content=@/path/to/file.csv"

Asset Content API

https://api.errthquake.com/assets/<workspace-uid>/<filename>

GET returns

asset file content

Content-Disposition header has value attachment; filename=<filename>

Content-Type header correctly identifies the file MIME type

DELETE deletes the test asset file and returns

asset-metadata-document

Asset Metadata API

https://api.errthquake.com/assets/<workspace-uid>/<filename>/metadata

GET returns

asset-metadata-document

Response Object Documents

Asset Metadata Document

{
  "filename": <string: asset filename>,
  "content-type": <string: file MIME type>,
  "asset-type": <string: asset type, "configuration", "inputset", or "object">,
  "size": <integer: file size in bytes>,
  "error": <string: any error associated with the asset>
}

The "error" attribute will indicate format errors such as an invalid YAML file submitted as a test configuration.