A result is a record of data or a file that has been published to a storage bucket. It contains the information necessary to retrieve this data from its storage location.
Attributes
| name | type | description |
|---|---|---|
id | result ID | Resource identifier. |
resource | string, always result | Resource type specifier. |
organisation | organisation ID | The organisation associated with this resource. |
poll | poll ID | The poll the result is associated with. |
task | task ID | The task the result is associated with. |
identifier | string | An identifier for the contents of the published data. |
url | string | The storage config url this result was published to. |
type | optional string | The file type, if identifiable. |
checksum | string | The md5 checksum of the stored data. |
size | int | The size of the published data, in bytes. |
signed_url | optional dictionary | Populated with signed URL details if enabled on the storage config in use. |
state | string | One of: available, consumed, expired. |
date_created | datetime | When the resource was created. |
date_consumed | datetime | When the result was acknowledged as consumed. |
date_deleted | datetime | When the result was removed from the storage location by the API. |
Signed URLs
If signed URL generation is enabled on the storage config used to publish the result, the signed_url will be set to a dictionary with the format:
{
"url": "<signed URL value here>",
"date_expires": "2020-02-29T11:59:15.110451Z"
}
The date_expires attribute indicates when the signed URL will cease to be valid. After this date, the result's signed_url attribute will be set to null.
See more details on configuring signed URLs in the storage config docs.
States
available
: The result is ready to be downloaded from the bucket.
consumed
: The result has been downloaded and the API has been informed.
expired
: The result has been deleted from the bucket by a scheduled cleanup. This state does not apply to client-owned buckets.
Retrieve GET /results/{result ID}
Using cURL
curl https://ricloud-api.reincubate.com/results/<result ID> \
-H 'Authorization: Token <your key_token>'
Using ricloud-py
import ricloud
results = ricloud.Result.retrieve(<result ID>)
List GET /results
Results in the states consumed or expired do not appear in the list by default.
Parameters
| name | type | description |
|---|---|---|
poll | poll ID | Filter by the associated poll. |
task | task ID | Filter by the associated task. |
identifier | string | Filter by the result identifier. |
checksum | string | Filter by the result checksum. |
state | string | Filter by the result state. |
date_created | datetime filter | Filter by when the resource was created. |
date_consumed | datetime filter | Filter by when the result was marked as consumed. |
date_deleted | datetime filter | Filter by when the result was marked as deleted. |
Using cURL
curl https://ricloud-api.reincubate.com/results \
-H 'Authorization: Token <your key_token>'
Using ricloud-py
import ricloud
results = ricloud.Result.list()
Acknowledge POST /results/{result ID}/ack
Acknowledge the result as having been consumed.
Using cURL
curl https://ricloud-api.reincubate.com/results/<result ID>/ack \
-X POST \
-H 'Authorization: Token <your key_token>'
Using ricloud-py
import ricloud
result = ricloud.Result.acknowledge_with_id(<result ID>)
# OR
result = ricloud.Result.retrieve(<result ID>)
result.acknowledge()
Batch acknowledge POST /results/ack
Acknowledge a batch of results as having been consumed.
The endpoint will not raise an error if any of the specified results have already been acknowledged or cannot be found.
| name | type | description |
|---|---|---|
ids | list of result IDs | A list of IDs of the results to be acknowledged. |
Using cURL
curl https://ricloud-api.reincubate.com/results/ack \
-X POST \
-H 'Authorization: Token <your key_token>' \
-H 'Content-Type: application/json' \
-d '{
"ids": ["<result ID>", "<result ID>"]
}'
Changelog
2020-02-27
- Adds the
signed_urlattribute to the result object. This is a nested dictionary containing the signed URL in theurlattribute and when it expires indate_expires. - Adds the ability to acknowledge results in batches with the new
POST /results/ackendpoint.
