Content service
POST /v3.0/{NS}/content/create?acct=<account_name>&ref=<container_name>&path=<file_path>
Create a new object. This method does not upload any data, it just registers object metadata in the database. It is supposed to be called after at least one call to the content/prepare2 route and a successful data upload to rawx services.
Most of the required information is available in the content/prepare2 response. Additional information must be computed by the client (object size and hash).
Sample request:
POST /v3.0/OPENIO/content/create?acct=my_account&ref=mycontainer&path=mycontent HTTP/1.1
Host: 127.0.0.1:6000
User-Agent: curl/7.47.0
Accept: */*
x-oio-content-meta-id: 2996752DFD7205006B73F17AD315AA2B
x-oio-content-meta-policy: SINGLE
x-oio-content-meta-size: 64
x-oio-content-meta-version: 554086800
x-oio-content-meta-chunk-method: plain/nb_copy=1
x-oio-content-meta-hash: 2996752DFD7205006B73F17AD315AA2B
x-oio-content-meta-mime-type: application/octet-stream
Content-Length: 165
Content-Type: application/x-www-form-urlencoded
{
"chunks": [
{
"url":"http://127.0.0.1:6012/D3F2...",
"pos":"0",
"size":1048576,
"hash":"00000000000000000000000000000000"
}
],
"properties": {
"category": "dogs"
}
}
The following request headers are mandatory: content ID, storage policy, size and version.
x-oio-content-meta-id: 2996752DFD7205006B73F17AD315AA2B
x-oio-content-meta-policy: SINGLE
x-oio-content-meta-size: 64
x-oio-content-meta-version: 554086800000000
The following request headers are recommended: content hash (MD5), mime-type, chunk method.
x-oio-content-meta-chunk-method: plain/nb_copy=1
x-oio-content-meta-hash: 2996752DFD7205006B73F17AD315AA2B
x-oio-content-meta-mime-type: application/octet-stream
The following header allows to set the versioning policy of the container hosting the object:
"x-oio-force-versioning: -1"
The following header tells that the object must be created as if the versioning was enabled and unlimited (this prevents the automatic garbage collection):
"x-oio-simulate-versioning: 1"
Sample response:
HTTP/1.1 204 No Content
Connection: Close
Content-Length: 0
POST /v3.0/{NS}/content/update?acct=<account_name>&ref=<container_name>&path=<file_path>
[
{
"url":"http://127.0.0.1:6012/D3F2...",
"pos":"0",
"size":1048576,
"hash":"00000000000000000000000000000000"
}
]
You must specify content length and ID on header
"x-oio-content-meta-id: 2996752DFD7205006B73F17AD315AA2B"
"x-oio-content-meta-size: 64"
Update existing object. This method does not upload any data, it just registers updated object metadata in the database.
POST /v3.0/OPENIO/content/update?acct=my_account&ref=mycontainer&path=mycontent HTTP/1.1
Host: 127.0.0.1:6000
User-Agent: curl/7.47.0
Accept: */*
x-oio-content-meta-size: 64
x-oio-content-meta-id: 2996752DFD7205006B73F17AD315AA2B
Content-Length: 165
Content-Type: application/x-www-form-urlencoded
HTTP/1.1 204 No Content
Connection: Close
Content-Length: 0
POST /v3.0/{NS}/content/truncate?acct={account}&ref={container}&path={file path}&size={int}
Truncate object at specified size.
POST /v3.0/OPENIO/content/truncate?acct=my_account&ref=mycontainer&path=mycontent&size=180 HTTP/1.1
Host: 127.0.0.1:6000
User-Agent: curl/7.47.0
Accept: */*
HTTP/1.1 204 No Content
Connetion: Close
Content-Length: 0
POST /v3.0/{NS}/content/prepare?acct={account}&ref={container}&path={file path}
{
"size": 42,
"policy": "SINGLE"
}
Prepare an upload: get URLs of chunks on available rawx.
POST /v3.0/OPENIO/content/prepare?acct=my_account&ref=mycontainer&path=mycontent HTTP/1.1
Host: 127.0.0.1:6000
User-Agent: curl/7.47.0
Accept: */*
Content-Length: 31
Content-Type: application/x-www-form-urlencoded
HTTP/1.1 200 OK
Connection: Close
Content-Type: application/json
Content-Length: 276
x-oio-ns-chunk-size: 1048576
x-oio-content-meta-chunk-method: plain/nb_copy=1
x-oio-content-meta-ctime: 1533215985
x-oio-content-meta-deleted: False
x-oio-content-meta-hash-method: md5
x-oio-content-meta-id: B03A29AA737205002C4D414D4C12FDC5
x-oio-content-meta-size: 180
x-oio-content-meta-mime-type: application/octet-stream
x-oio-content-meta-name: mycontent
x-oio-content-meta-policy: SINGLE
x-oio-content-meta-version: 1533215985187506
POST /v3.0/{NS}/content/prepare2?acct={account}&ref={container}&path={file path}
Prepare an upload: get URLs of chunks on available rawx.
Sample request:
POST /v3.0/OPENIO/content/prepare2?acct=my_account&ref=mycontainer&path=mycontent HTTP/1.1
Host: 127.0.0.1:6000
User-Agent: curl/7.47.0
Accept: */*
Content-Length: 31
Content-Type: application/x-www-form-urlencoded
{
"size": 42,
"policy": "SINGLE"
}
Sample response:
HTTP/1.1 200 OK
Connection: Close
Content-Type: application/json
Content-Length: 276
x-oio-ns-chunk-size: 1048576
x-oio-content-meta-chunk-method: plain/nb_copy=1
x-oio-content-meta-ctime: 1533215985
x-oio-content-meta-deleted: False
x-oio-content-meta-hash-method: md5
x-oio-content-meta-id: B03A29AA737205002C4D414D4C12FDC5
x-oio-content-meta-size: 180
x-oio-content-meta-mime-type: application/octet-stream
x-oio-content-meta-name: mycontent
x-oio-content-meta-policy: SINGLE
x-oio-content-meta-version: 1533215985187506
GET /v3.0/{NS}/content/show?acct={account}&ref={container}&path={file path}
Get a description of the content along with its user properties.
POST /v3.0/OPENIO/content/show?acct=my_account&ref=mycontainer&path=mycontent HTTP/1.1
Host: 127.0.0.1:6000
User-Agent: curl/7.47.0
Accept: */*
HTTP/1.1 200 OK
Connection: Close
Content-Type: application/json
Content-Length: 272
x-oio-content-meta-chunk-method: plain/nb_copy=1
x-oio-content-meta-ctime: 1533546157
x-oio-content-meta-deleted: False
x-oio-content-meta-hash: 26CBCBBF52F37322FAC57B8AC0E4E130
x-oio-content-meta-hash-method: md5
x-oio-content-meta-id: FB35FC89C072050065F28C69311740F6
x-oio-content-meta-size: 180
x-oio-content-meta-mime-type: application/octet-stream
x-oio-content-meta-name: mycontent
x-oio-content-meta-policy: SINGLE
x-oio-content-meta-version: 1533546157848061
[{"url":"http://127.0.0.1:6012/BADD4...", ...}]
POST /v3.0/{NS}/content/delete?acct={account}&ref={container}&path={file path}
If the versioning is enabled, you can add delete marker to a specific version
POST /v3.0/OPENIO/content/delete?acct=my_account&ref=mycontainer&path=mycontent&version=9876543210&delete_marker=1 HTTP/1.1
Unreference object from container
"x-oio-force-versioning: -1"
You can delete this object as if the versioning is enabled
"x-oio-simulate-versioning: 1"
Unreference object from container
POST /v3.0/OPENIO/content/delete?acct=my_account&ref=mycontainer&path=mycontent HTTP/1.1
Host: 127.0.0.1:6000
User-Agent: curl/7.47.0
Accept: */*
HTTP/1.1 204 No Content
Connection: Close
Content-Length: 0
POST /v3.0/{NS}/content/delete_many?acct={account}&ref={container}
You can update system property policy.version of container
{
"contents":[{"name":"content0"}, {"name":"content1"}]
}
Unreference many object from container
POST /v3.0/OPENIO/content/delete_many?acct=my_account&ref=mycontainer HTTP/1.1
Host: 127.0.0.1:6000
User-Agent: curl/7.47.0
Accept: */*
Content-Length: 55
Content-Type: application/x-www-form-urlencoded
HTTP/1.1 200 OK
Connection: Close
Content-Type: application/json
Content-Length: 146
{
"contents":[{"name":"content0","status":204,"message":"ok"},{"name":"content1","status":204,"message":"ok"}]
}
POST /v3.0/{NS}/content/touch?acct={account}&ref={container}&path={file path}
Send an event to update object and object size on container.
POST /v3.0/OPENIO/content/touch?acct=my_account&ref=mycontainer&path=mycontent HTTP/1.1
Host: 127.0.0.1:6000
User-Agent: curl/7.47.0
Accept: */*
HTTP/1.1 204 No Content
Connection: Close
Content-Length: 0
POST /v3.0/{NS}/content/spare?acct={account_name}&ref={container_name}&path={file_path}
Get spare chunk addresses, in order to replace broken or missing chunks. Doesn’t work with “single” storage policy.
Sample request:
POST /v3.0/OPENIO/content/spare?acct=my_account&ref=mycontainer&path=mycontent HTTP/1.1
Host: 127.0.0.1:6000
User-Agent: curl/7.47.0
Accept: */*
x-oio-content-meta-size: 64
x-oio-content-meta-id: 2996752DFD7205006B73F17AD315AA2B
Content-Length: 182
Content-Type: application/x-www-form-urlencoded
{
"notin": <list of current chunks>,
"broken": <list of broken chunks>
}
Sample response:
HTTP/1.1 200 OK
Connection: Close
Content-Type: application/json
Content-Length: 292
{
"aliases":[],
"headers":[],
"chunks":[{"id":"http:\/\/127.0.0.1:6011\/FFD794D6527AC176..."}]
}
POST /v3.0/{NS}/content/get_properties?acct={account}&ref={container}&path={file path}
Get object properties.
POST /v3.0/OPENIO/content/get_properties?acct=my_account&ref=mycontainer&path=mycontent HTTP/1.1
Host: 127.0.0.1:6000
User-Agent: curl/7.47.0
Accept: */*
HTTP/1.1 200 OK
Connection: Close
Content-Type: application/json
Content-Length: 17
x-oio-content-meta-chunk-method: plain/nb_copy=1
x-oio-content-meta-ctime: 1533215985
x-oio-content-meta-deleted: False
x-oio-content-meta-hash: 26CBCBBF52F37322FAC57B8AC0E4E130
x-oio-content-meta-hash-method: md5
x-oio-content-meta-id: B03A29AA737205002C4D414D4C12FDC5
x-oio-content-meta-size: 180
x-oio-content-meta-mime-type: application/octet-stream
x-oio-content-meta-name: mycontent
x-oio-content-meta-policy: SINGLE
x-oio-content-meta-version: 1533215985187506
{"properties":{}}
POST /v3.0/{NS}/content/set_properties?acct={account}&ref={container}?&path={file path}
{
"properties":{"test":"1"}
}
Set object properties.
POST /v3.0/OPENIO/content/set_properties?acct=my_account&ref=mycontainer&path=mycontent HTTP/1.1
Host: 127.0.0.1:6000
User-Agent: curl/7.47.0
Accept: */*
Content-Length: 27
Content-Type: application/x-www-form-urlencoded
HTTP/1.1 204 No Content
Connection: Close
Content-Length: 0
POST /v3.0/{NS}/content/del_properties?acct={account}&ref={container}?&path={file path}
["test"]
Delete object properties.
POST /v3.0/OPENIO/content/del_properties?acct=my_account&ref=mycontainer&path=mycontent HTTP/1.1
Host: 127.0.0.1:6000
User-Agent: curl/7.47.0
Accept: */*
Content-Length: 8
Content-Type: application/x-www-form-urlencoded
HTTP/1.1 204 No Content
Connection: Close
Content-Length: 0
POST /v3.0/{NS}/content/drain?acct={account}&ref={container}&path={file path}
Remove all the chunks of a content but keep the properties. We can replace the data or the properties of the content but no action needing the removed chunks are accepted
POST /v3.0/OPENIO/content/drain?acct=my_account&ref=mycontainer&path=mycontent HTTP/1.1
Host: 127.0.0.1:6000
User-Agent: curl/7.47.0
Accept: */*
HTTP/1.1 204 No Content
Connection: Close
Content-Length: 0
POST /v3.0/{NS}/content/purge?acct={account}&ref={container}&path={file path}
Purge object content.
POST /v3.0/OPENIO/content/purge?acct=my_account&ref=mycontainer&path=mycontent HTTP/1.1
Host: 127.0.0.1:6000
User-Agent: curl/7.47.0
Accept: */*
HTTP/1.1 204 No Content
Connection: Close
Content-Length: 0