Write data
PUT /<org_name>/<path>/<data_item_name>.data
Data Items
For data, Registry is a key-value store of registers (a.k.a., data items). A client can write, delete, and read small blobs of 100 KB (configurable) or smaller. Blobs can be overwritten or deleted, but not edited in other ways. When a blob is written, its content type (specified by Content-Type header) is saved, and it is returned along with the blob when read. The service only looks at the blob’s size but does not look into its contents, not even for checksumming. If the client desires encryption, checksumming, or error-correcting of their data, they need to do those at the client side.
A write stores any data up to 100 KB (100,000 bytes). A data item has a create_org_time and an update_org_time that record the org time at creation and last update, respectively. A write can be conditioned on the update org time to avoid race conditions between clients.
Request
Example
PUT /<org_name>/<path>/<data_item_name>.data
Host: <service_address>
Authorization: <org_key>
x-dk-update-org-time: <u64>
Content-Type: <any>
Body is Data
PUT /sample_org/nemmies/rolls/recipe.data
Host: beta.useast2.registry.dkplatform.io
Authorization: randomAlphaNumericString
Content-Type: text/plain
The secret ingredient is passion!!
Param | Meaning |
---|---|
Authorization | The credential showing the client's permission for the request. It is the `org_key` of the org. |
Host | The service address, such as "useast2.registry.dkplatform.io". |
x-dk-org-time | A response header that shows the org_time after the request is executed. |
x-dk-update-org-time | An optional request header for conditional update and delete of data. |
"create_org_time" | The org time right after a data item is created. |
"update_org_time" | The org time right after a data item is updated. |
"max_allowed_size" | The number of bytes of the largest data item allowed. |
Response
200 OK x-dk-org-time: <u64> { "create_org_time": <u64>, "update_org_time": <u64>, } | Success, the existing data item is replaced by the one in the request. |
201 CREATED x-dk-org-time: <u64> { "create_org_time": <u64>, "update_org_time": <u64>, } | Success, no data item with the same name existed. A new item has been created. |
400 BAD REQUEST | Wrong format in org, path, or data item name. Missing Authorization header, or Authorization header is empty. |
404 NOT FOUND | There is no such org, the org has been flagged for deletion, or (for confidentiality concern) the Authorization token is invalid. |
409 CONFLICT x-dk-org-time: <u64> { "update_org_time": <u64>, } | A data item exists with the same name and different update org time. |
413 PAYLOAD TOO LARGE { "max_allowed_size": <u32>, } | The data is too large. |
500 INTERNAL SERVER ERROR | An unexpected error happened at the server. It is unsure if the request has been processed or not. |
507 INSUFFICIENT STORAGE | The service does not have enough storage to handle the request. |