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 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_attachments attribute to add the attachment to either you 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",
    "arc_attachments": [
      {
        "arc_display_name": "Conformance Report",
        "arc_attachment_identity": "blobs/e2a1d16c-03cd-45a1-8cd0-690831df1273",
        "arc_hash_value": "8a1eef8ab0ad431b7e2a900fc15ad8216f010fd8e4bf739604cec39fb1f94049",
        "arc_hash_alg": "SHA-256"
      }]
  },
  "asset_attributes": {
    "arc_attachments": [
      {
        "arc_display_name": "Latest Conformance Report",
        "arc_attachment_identity": "blobs/e2a1d16c-03cd-45a1-8cd0-690831df1273",
        "arc_hash_value": "8a1eef8ab0ad431b7e2a900fc15ad8216f010fd8e4bf739604cec39fb1f94049",
        "arc_hash_alg": "SHA-256"
      }]
  },
  "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",
    "arc_attachments": [
      {
        "arc_display_name": "Conformance Report",
        "arc_attachment_identity": "blobs/e2a1d16c-03cd-45a1-8cd0-690831df1273",
        "arc_hash_value": "8a1eef8ab0ad431b7e2a900fc15ad8216f010fd8e4bf739604cec39fb1f94049",
        "arc_hash_alg": "SHA-256"
      }]
  },
  "asset_attributes": {
    "arc_attachments": [
      {
        "arc_display_name": "Latest Conformance Report",
        "arc_attachment_identity": "blobs/e2a1d16c-03cd-45a1-8cd0-690831df1273",
        "arc_hash_value": "8a1eef8ab0ad431b7e2a900fc15ad8216f010fd8e4bf739604cec39fb1f94049",
        "arc_hash_alg": "SHA-256"
      }]
  },
  "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

post  /archivist/v2/assets/{uuid}/events

Description:

ParameterTypeRequiredDescription
uuidstringtrueSpecify 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
bodytrue

{
  "asset_attributes": {
    "arc_firmware_version": "3.2.1",
    "arc_home_location_identity": "locations/42054f10-9952-4c10-a082-9fd0d10295ae"
  },
  "asset_identity": "assets/add30235-1424-4fda-840a-d5ef82c4c96f",
  "behaviour": "RecordEvidence",
  "block_number": 12,
  "confirmation_status": "CONFIRMED",
  "event_attributes": {
    "arc_attachments": [
      {
        "arc_attachment_identity": "blobs/1754b920-cf20-4d7e-9d36-9ed7d479744d",
        "arc_display_name": "Picture from yesterday",
        "arc_hash_alg": "sha256",
        "arc_hash_value": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b"
      }
    ]
  },
  "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"
  },
  "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 ParameterTypeDescription
asset_attributesobjectkey value mapping of asset attributes
asset_identitystringidentity of a related asset resource assets/11bf5b37-e0b8-42e0-8dcf-dc8c4aefc000
behaviourstringThe behaviour used to create event. RecordEvidence
block_numberstringnumber of block event was commited on
confirmation_statusstringindicates if the event has been succesfully committed to the blockchain
event_attributesobjectkey value mapping of event attributes
fromstringwallet address for the creator of this event
identitystringidentity of a event resource
operationstringThe operation represented by the event. Record
principal_acceptedobjectprincipal recorded by the server
principal_declaredobjectprincipal provided by the user
timestamp_acceptedstringtime of event as recorded by the server
timestamp_committedstringtime of event as recorded on blockchain
timestamp_declaredstringtime of event as declared by the user
transaction_idstringhash of the transaction as a hex string 0x11bf5b37e0b842e08dcfdc8c4aefc000
transaction_indexstringindex of event within commited block
ResponsesDescription
200A successful response.
defaultAn unexpected error response.

Edit this page on GitHub