DWN Requests

In the Zion Aggregator, DWNs feed messages that the user designates through the use of handlers. Data that meets certain conditions set by the user and aggregator is sent to the aggregator for indexing, and unlike traditional aggregators, permission for data can be revoked by DWN owners at any time thus removing the aggregator's access to that data.

Currently Zion DWNs have three types of requests. These requests are formatted as Messages. Currently, Zion DWNs utilize three types of Messages: CollectionsWrite, CollectionsCommit and CollectionsDelete.

CollectionsWrite

CollectionWrite requests are for posting a new item in a collection. The format for a CollectionsWrite request is:

{  // Request Object
  "target": "did:zion:123",// Community DID
  "messages": [  // Message Objects
    {
      "data": {
        "image": "...",
        "text": "Some stuff I ate for lunch",
        ... 
      }, // Base64URL String Representation of this object
      "descriptor": {
        "nonce": "9b9c7f1fcabfc471ee2682890b58a427ba2c8db59ddf3c2d5ad16ccc84bb3106",
        "method": "CollectionsWrite",
        "recordId": "b6464162-84af-4aab-aff5-f1f8438dfc1e", // the record ID you are creating
        "dataCid": "", //CID V1 of the data field
        "dataFormat": "application/json",
        "dateCreated": 123456789,
        "schema": "https://schema.org/SocialMediaPosting", // Can be a key for a hardcoded custom ZION schema
        "protocol": "zion.fyi/social-protocol/v1"
      },
        "attestation": {
        "protected": {
          "alg": "ES256K",
          "kid": "did:example:123#key-1"
        },
        "payload": "", // CID V1 of the descriptor,
        "signature": "" //JWS of (protected + payload)
      } // JWS Compact Object string
    },
  ]
}

CollectionsCommit

CollectionsCommit requests are for updating an existing item in a collection. This will effectively replace that item. The format for a CollectionsCommit request is:

{  // Request Object
  "target": "did:zion:123",// Community DID
  "messages": [  // Message Objects
    {
      "data": {
        "image": "...",
        "text": "Some stuff I ate for lunch, and a snack",
        ... 
      }, // Base64URL String Representation of this object
      "descriptor": {
        "nonce": "9b9c7f1fcabfc471ee2682890b58a427ba2c8db59ddf3c2d5ad16ccc84bb3106",
        "method": "CollectionsCommit",
        "recordId": "b6464162-84af-4aab-aff5-f1f8438dfc1e", // ID for the record looking to update
        "dataCid": "", //CID V1 of the data field
        "dataFormat": "application/json",
        "dateCreated": 123456789, // Should be the time of the original creation
        "datePublished": 123456789, // Should be now
        "schema": "https://schema.org/SocialMediaPosting", // Can be a key for a hardcoded custom ZION schema
        "protocol": "zion.fyi/social-protocol/v1"
      },
        "attestation": {
        "protected": {
          "alg": "ES256K",
          "kid": "did:example:123#key-1"
        },
        "payload": "", // CID V1 of the descriptor,
        "signature": "" //JWS of (protected + payload)
      } // JWS Compact Object string
    },
  ]
}

CollectionsDelete

CollectionsDelete requests are for removing an item of a collection. Once deleted an item will be unrecoverable. The format for a CollectionsDelete request is:

{  // Request Object
  "target": "did:zion:123",// Community DID
  "messages": [  // Message Objects
    {
      "descriptor": {
        "nonce": "9b9c7f1fcabfc471ee2682890b58a427ba2c8db59ddf3c2d5ad16ccc84bb3106",
        "method": "CollectionsDelete",
        "recordId": "b6464162-84af-4aab-aff5-f1f8438dfc1e", // the record for deletion
        "schema": "https://schema.org/SocialMediaPosting", // Can be a key for a hardcoded custom ZION schema
        "protocol": "zion.fyi/social-protocol/v1"
      },
        "attestation": {
        "protected": {
          "alg": "ES256K",
          "kid": "did:example:123#key-1"
        },
        "payload": "", // CID V1 of the descriptor,
        "signature": "" //JWS of (protected + payload)
      } // JWS Compact Object string
    },
  ]
}

Last updated