Appendable Data is explained in detail in the RFC.
Operation on the Appendable Data would require the handle for the Appendable Data. Since a handle is passed to the application, the applications must drop the handle after its usage.
Appendable data can be either public or private type.
Type | Description |
---|---|
Public | data appended can be read by others |
Private | data appended to it can only be read by the owner |
The appendable data can be fetched from network based on its Id. The Id is a base64 string representing [u8; 32] array.
The appendable data also provides option to filter users by public key. Two filter types are supported, Whitelist(allow) or Blacklist(restrict).
After creating the Appendable data the PUT endpoint must be invoked for saving the appendable data in the network
POST /appendable-data/
Authorization: Bearer <TOKEN>
Field | Description |
---|---|
name | base64 string representing [u8; 32] array |
isPrivate | Boolean. Optional Defaults to false |
filterType | Enum value. WHITE_LIST, BLACK_LIST. Defaults to BLACK_LIST |
filterKey | List of signing key handles. Optional value defaults to empty list |
{
name: base64 string,
isPrivate: Boolean,
filterType: Enum,
filterKeys: list of signing key handles
}
200
{
handleId:u64 number representing the appendable data handle id
}
The safe_core calls PUT to store the data in the network and POST to update an existing data in the network. When a appendable data is created for the first time the application should call the PUT endpoint and while updating an AppendableData the application should call the POST endpoint.
PUT /appendable-data/{handleId}
POST /appendable-data/{handleId}
Authorization: Bearer <TOKEN>
200
Get the handle for appendable data. Unauthorised access is allowed.
GET /appendable-data/handle/{DataIdentifier-Handle}
Authorization: Bearer <TOKEN>
200
{
handleId: u64 number representing the appendable data handle id,
isOwner: Boolean,
version: u64,
filterType: ENUM,
dataLength: Number,
deletedDataLength: Number
}
Get metadata of appendable data. Unauthorised access is allowed.
GET /appendable-data/metadata/Handle-Id}
Authorization: Bearer <TOKEN>
200
{
isOwner: Boolean,
version: u64,
filterType: ENUM,
dataLength: Number,
deletedDataLength: Number
}
Get encryption key of the owner for private appendable data. Handle for the encryption key is returned.
GET /appendable-data/encrypt-key/{Handle-Id}
Authorization: Bearer <TOKEN>
{
handleId: Number // handle id as u64
}
The handle for the signing key is returned
GET /appendable-data/sign-Key/{Handle-Id}/{index}
Authorization: Bearer <TOKEN>
{
handleId: u64 // representing Signing key handle
}
Get Signing key from deleted section of the appendable data by index
GET /appendable-data/sign-key/deleted-data/{Handle-Id}/{index}
Authorization: Bearer <TOKEN>
{
handleId: u64 // representing signing key handle
}
Drop Sign key handle. Unauthorised access is allowed
DELETE /appendable-data/sign-key/{Handle-Id}
Authorization: Bearer <TOKEN>
200
GET /appendable-data/data-id/{Handle-Id}
Authorization: Bearer <TOKEN>
{
handleId: u64 // representing DataIdentifier handle
}
Returns the dataid handle of a data based on the index from the Appendable data's data section.
Unauthorised access is allowed for Public AppendableData
GET /appendable-data/{Handle-Id}/{index}
Authorization: Bearer <TOKEN>
{
handleId: u64 // representing DataIdentifier handle
}
Returns the dataid handle of a data based on the index from the Appendable data's data section.
GET /appendable-data/deleted-data/{Handle-Id}/{index}
Authorization: Bearer <TOKEN>
{
handleId: u64 // representing DataIdentifier handle
}
This will add to the appendable data and update to the network. No need to invoke POST endpoint for this change to reflect.
PUT /appendable-data/{Handle-Id}/{DataIdentifier-Handle-Id}
Authorization: Bearer <TOKEN>
200
The api will toggle the filter and also reset all the filter keys.
PUT /appendable-data/toggle-filter/{Handle-Id}
Authorization: Bearer <TOKEN>
200
PUT /appendable-data/filter/{Handle-Id}
Authorization: Bearer <TOKEN>
[] // list of signing key handles
200
DELETE /appendable-data/filter/{Handle-Id}
Authorization: Bearer <TOKEN>
[] // list of sign key handles
200
Remove data held in the appendable data based on index. This operation will move the data
to the deleted
section in the AppendableData.
Field | Description |
---|---|
index | Index of the data to be deleted from appendable data. Defaults to 0 |
DELETE /appendable-data/{Handle-Id}
Authorization: Bearer <TOKEN>
[] // list of index to be removed
200
Remove deleted data held in the appendable data based on index.
Field | Description |
---|---|
index | Index of the data to be deleted from appendable data. Defaults to 0 |
DELETE /appendable-data/deletedData/{Handle-Id}
Authorization: Bearer <TOKEN>
[] // list of index to be removed
200
DELETE /appendable-data/clear-data/{handleId}
Authorization: Bearer <TOKEN>
200
DELETE /appendable-data/clear-deleted-data/{handleId}
Authorization: Bearer <TOKEN>
200
PUT /appendable-data/restore/{Handle-Id}/{deletedIndex}
Authorization: Bearer <TOKEN>
200
GET /appendable-data/serialise/{Handle-Id}
Authorization: Bearer <TOKEN>
200
Binary data [u8]
Unauthorised access is permitted
POST /appendable-data/deserialise
Authorization: Bearer <TOKEN>
Binary data [u8]
200
{
handleId: u64 number representing the appendable data handle id,
isOwner: Boolean,
version: u64,
filterType: ENUM,
dataLength: Number,
deletedDataLength: Number
}
Unauthorised access is allowed.
DELETE /appendable-data/handle/{Handle-Id}
Authorization: Bearer <TOKEN>
200