Webtask

Documentation

Webtask storage

Built-in storage management

Storage management

Whenever you want to manage the built-in storage of your webtask — setting or getting the data within it — you can do so with the webtask data API.

Importing data

HTTPS PUT /api/webtask/{webtask_container}/{webtask_name}/data
Content-Type: application/json

The request must be authenticated by specifying the A1 webtask token as the key URL query parameter or with the Authorization HTTP request header as described above. The content type of the request must be application/json. The body of the request must contain a JSON object having the following fields:

data

Pass in the data as a string (e.g. a JSON string).

etag

Pass in an optional string to be used for optimistic concurrency control to prevent simultaneous updates of the same data.

Exporting data

HTTPS GET /api/webtask/{webtask_container}/{webtask_name}/data

The request must be authenticated by specifying the A1 webtask token as the key URL query parameter or with the Authorization HTTP request header as described above.

Response

When the request is successful, the response code will be 200 and the body a JSON object with the data and etag properties.

If the storage is empty — the absence of any previously set data — the contents of data will default to an empty object.