Events API
Events API Reference
Events API Examples
Create the bearer_token and store in a file in a secure local directory with 0600 permissions.
Event Creation
Define the Event parameters and store in /path/to/jsonfile
:
{
"operation": "Record",
"behaviour": "RecordEvidence",
"event_attributes": {
"arc_display_type": "Safety Conformance",
"Safety Rating": "90",
"inspector": "spacetime"
},
"timestamp_declared": "2019-11-27T14:44:19Z",
"principal_declared": {
"issuer": "idp.synsation.io/1234",
"subject": "phil.b",
"email": "phil.b@synsation.io"
}
}
Note:RecordEvidence
is the primary, default behaviour for creating Events.
Add the request to the Asset record by POSTing it to the resource:
curl -v -X POST \
-H "@$BEARER_TOKEN_FILE" \
-H "Content-type: application/json" \
-d "@/path/to/jsonfile" \
https://app.rkvst.io/archivist/v2/assets/add30235-1424-4fda-840a-d5ef82c4c96f/events
The response is:
{
"identity": "assets/add30235-1424-4fda-840a-d5ef82c4c96f/events/11bf5b37-e0b8-42e0-8dcf-dc8c4aefc000",
"asset_identity": "assets/add30235-1424-4fda-840a-d5ef82c4c96f",
"operation": "Record",
"behaviour": "RecordEvidence",
"event_attributes": {
"arc_display_type": "Safety Conformance",
"Safety Rating": "90",
"inspector": "spacetime"
},
"timestamp_accepted": "2019-11-27T15:13:21Z",
"timestamp_declared": "2019-11-27T14:44:19Z",
"timestamp_committed": "2019-11-27T15:15:02Z",
"principal_declared": {
"issuer": "idp.synsation.io/1234",
"subject": "phil.b",
"email": "phil.b@synsation.io"
},
"principal_accepted": {
"issuer": "job.idp.server/1234",
"subject": "bob@job"
},
"confirmation_status": "CONFIRMED",
"block_number": 12,
"transaction_index": 5,
"transaction_id": "0x07569"
}
Adding Attachments
The following assumes that an attachment has already been uploaded to RKVST using the Blob API.
This attachment uuid is generically referred to as:
blobs/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Each attachment has an associated hash value and the name of the hash algorithm used that you can also get from the Blob API response.
Once you’ve uploaded your file, you can use the "arc_attribute_type": "arc_attachment"
key-value pair within a dictionary of blob information to add the attachment to either your Asset or Event.
The following example shows you usage with both the event_attributes
and the asset_attributes
:
{
"operation": "Record",
"behaviour": "RecordEvidence",
"event_attributes": {
"arc_display_type": "Safety Conformance",
"arc_description": "Safety conformance approved for version 1.6. See attached conformance report",
"arc_evidence": "DVA Conformance Report attached",
"conformance_report": {
"arc_attribute_type": "arc_attachment",
"arc_blob_hash_value": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
"arc_blob_identity": "blobs/1754b920-cf20-4d7e-9d36-9ed7d479744d",
"arc_blob_hash_alg": "SHA256",
"arc_file_name": "safety_conformance.pdf",
"arc_display_name": "Conformance Report",
},
"arc_primary_image": {
"arc_attribute_type": "arc_attachment",
"arc_blob_hash_value": "3276336c6fa5064e7b7a894ff7252738330a5748dbcb61a56cd9a20b7383bd30",
"arc_blob_identity": "blobs/28ba5c11-04f4-7d9e-104a-e9f6b3cc7b11",
"arc_blob_hash_alg": "SHA256",
"arc_file_name": "photo.jpg",
"arc_display_name": "arc_primary_image",
},
},
"asset_attributes": {
"latest_conformance_report": {
"arc_attribute_type": "arc_attachment",
"arc_blob_hash_value": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
"arc_blob_identity": "blobs/1754b920-cf20-4d7e-9d36-9ed7d479744d",
"arc_blob_hash_alg": "SHA256",
"arc_file_name": "safety_conformance.pdf",
"arc_display_name": "Latest Conformance Report",
},
},
"timestamp_declared": "2019-11-27T14:44:19Z",
"principal_declared": {
"issuer": "idp.synsation.io/1234",
"subject": "phil.b",
"email": "phil.b@synsation.io"
},
}
Add the request to the Asset Record by POSTing it to the resource:
curl -v -X POST \
-H "@$BEARER_TOKEN_FILE" \
-H "Content-type: application/json" \
-d "@/path/to/jsonfile" \
https://app.rkvst.io/archivist/v2/assets/add30235-1424-4fda-840a-d5ef82c4c96f/events
You should see the response:
{
"identity": "assets/add30235-1424-4fda-840a-d5ef82c4c96f/events/11bf5b37-e0b8-42e0-8dcf-dc8c4aefc000",
"asset_identity": "assets/add30235-1424-4fda-840a-d5ef82c4c96f",
"operation": "Record",
"behaviour": "RecordEvidence",
"event_attributes": {
"arc_display_type": "Safety Conformance",
"arc_description": "Safety conformance approved for version 1.6. See attached conformance report",
"arc_evidence": "DVA Conformance Report attached",
"conformance_report": {
"arc_attribute_type": "arc_attachment",
"arc_blob_hash_value": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
"arc_blob_identity": "blobs/1754b920-cf20-4d7e-9d36-9ed7d479744d",
"arc_blob_hash_alg": "SHA256",
"arc_file_name": "safety_conformance.pdf",
"arc_display_name": "Conformance Report",
},
"arc_primary_image": {
"arc_attribute_type": "arc_attachment",
"arc_blob_hash_value": "3276336c6fa5064e7b7a894ff7252738330a5748dbcb61a56cd9a20b7383bd30",
"arc_blob_identity": "blobs/28ba5c11-04f4-7d9e-104a-e9f6b3cc7b11",
"arc_blob_hash_alg": "SHA256",
"arc_file_name": "safety_conformance.pdf",
"arc_display_name": "Conformance Report",
},
},
"asset_attributes": {
"latest_conformance_report": {
"arc_attribute_type": "arc_attachment",
"arc_blob_hash_value": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
"arc_blob_identity": "blobs/1754b920-cf20-4d7e-9d36-9ed7d479744d",
"arc_blob_hash_alg": "SHA256",
"arc_file_name": "safety_conformance.pdf",
"arc_display_name": "Latest Conformance Report",
},
},
"timestamp_accepted": "2019-11-27T15:13:21Z",
"timestamp_declared": "2019-11-27T14:44:19Z",
"timestamp_committed": "2019-11-27T15:15:02Z",
"principal_declared": {
"issuer": "idp.synsation.io/1234",
"subject": "phil.b",
"email": "phil.b@synsation.io"
},
"principal_accepted": {
"issuer": "job.idp.server/1234",
"subject": "bob@job"
},
"confirmation_status": "CONFIRMED",
"block_number": 12,
"transaction_index": 5,
"transaction_id": "0x07569"
}
Events OpenAPI Docs
API to manage RecordEvidence Behaviour.
post /archivist/v2/assets/{uuid}/events
Description:
Parameter | Type | Required | Description |
---|---|---|---|
uuid | string | true | Specify the Asset UUID where assets/{uuid} is the Asset Identity e.g. add30235-1424-4fda-840a-d5ef82c4c96f from Identity assets/add30235-1424-4fda-840a-d5ef82c4c96f |
body | true |
{
"asset_attributes": {
"colour": "Midnight Blue"
},
"asset_identity": "assets/add30235-1424-4fda-840a-d5ef82c4c96f",
"behaviour": "RecordEvidence",
"block_number": 12,
"confirmation_status": "CONFIRMED",
"event_attributes": {
"arc_description": "Painted the fence",
"arc_display_type": "Paint"
},
"identity": "assets/add30235-1424-4fda-840a-d5ef82c4c96f/events/11bf5b37-e0b8-42e0-8dcf-dc8c4aefc000",
"operation": "Record",
"principal_accepted": {
"issuer": "job.idp.server/1234",
"subject": "bob@job"
},
"principal_declared": {
"issuer": "job.idp.server/1234",
"subject": "bob@job"
},
"tenant_identity": "tenant/8e0b600c-8234-43e4-860c-e95bdcd695a9",
"timestamp_accepted": "2019-11-27T14:44:19Z",
"timestamp_committed": "2019-11-27T14:44:19Z",
"timestamp_declared": "2019-11-27T14:44:19Z",
"transaction_id": "0x07569",
"transaction_index": 5
}
Response Parameter | Type | Description |
---|---|---|
asset_attributes | object | key value mapping of asset attributes |
asset_identity | string | identity of a related asset resource assets/11bf5b37-e0b8-42e0-8dcf-dc8c4aefc000 |
behaviour | string | The behaviour used to create event. RecordEvidence |
block_number | string | number of block event was commited on |
confirmation_status | string | indicates if the event has been succesfully committed to the blockchain |
event_attributes | object | key value mapping of event attributes |
from | string | wallet address for the creator of this event |
identity | string | identity of a event resource |
operation | string | The operation represented by the event. Record |
principal_accepted | object | principal recorded by the server |
principal_declared | object | principal provided by the user |
tenant_identity | string | Identity of the tenant the that created this event |
timestamp_accepted | string | time of event as recorded by the server |
timestamp_committed | string | time of event as recorded on blockchain |
timestamp_declared | string | time of event as declared by the user |
transaction_id | string | hash of the transaction as a hex string 0x11bf5b37e0b842e08dcfdc8c4aefc000 |
transaction_index | string | index of event within commited block |
Responses | Description |
---|---|
200 | A successful response. |