Subscribe to file events
This method subscribes through HTTP streaming on events of specific type for a given space.
Until the connection is kept alive, the events will be streamed to subscribers as soon as they are occur. The optional timeout parameter can be used to automatically disconnect when no events occur in a given time window.
This operation requires space_view_changes_stream privilege.
Example cURL requests
Listen to space change events
curl -N -X POST -d "@./changes_req.json" -H "X-Auth-Token: $TOKEN" \
"https://$HOST/api/v3/oneprovider/changes/metadata/$SPACE_ID"
Path parameters
| Parameter | Type & Description |
|---|---|
| sid required | string Space Id. |
Query parameters
| Parameter | Type & Description |
|---|---|
| timeout | integer Optional timeout in milliseconds, which allows to automatically break connection when no event occured in specified time. By default the timeout is unlimited. |
| last_seq | integer Last known file metadata sequence number |
Request body
Specification of metadata changes to observe.
| Property | Type & Description | ||||||
|---|---|---|---|---|---|---|---|
triggers array of strings List of documents which modifications should trigger sending changes. | |||||||
fileMeta object Specification of fileMeta fields to observe.
| |||||||
fileLocation object Specification of fileLocation fields to observe.
| |||||||
times object Specification of times fields to observe.
| |||||||
customMetadata object Specification of customMetadata fields to observe.
| |||||||
Request Examples
cat changes_req.json | oneprovider-rest-cli streamSpaceChanges sid=$SPACE_ID timeout=10000 last_seq=124721 -Responses
Subscription to events has been successful.
| Property | Type & Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fileId string Unique Id of the file. | |||||||||||||||||||||||||
filePath string Absolute path to the file (starting with the Space name). | |||||||||||||||||||||||||
seq string Sequence number (version) of the metadata document. | |||||||||||||||||||||||||
fileMeta object Requested fileMeta fields and additional information.
| |||||||||||||||||||||||||
fileLocation object Requested fileLocation fields and additional information.
| |||||||||||||||||||||||||
times object Requested times fields and additional information.
| |||||||||||||||||||||||||
customMetadata object Requested customMetadata fields and additional information.
| |||||||||||||||||||||||||
Example
{
"fileId": "4efc4a0c-0a61-4766-8fe9-c3d7fb414da8",
"filePath": "/Space1/dir2/file1.txt",
"seq": 123,
"fileMeta": {
"rev": "2-c500a5eb026d9474429903d47841f9c5",
"mutators": [
"<<\"p1.1542789098.test\">>"
],
"changed": true,
"deleted": false,
"fields": {
"owner": "john"
}
},
"customMetadata": {
"rev": "1-09f941b4e8452ef6a244c5181d894814",
"mutators": [
"<<\"p1.1542789098.test\">>"
],
"changed": false,
"deleted": false,
"exists": {
"onedata_json": true
},
"fields": {
"key1": "value1"
}
}
}Invalid request.
| Property | Type & Description |
|---|---|
error string Identifier representing internal error code. | |
error_description string Detailed error message. | |
Example
{
"error": "invalid_token",
"error_description": "Provided token could not be validated."
}Forbidden request.
| Property | Type & Description |
|---|---|
error string Identifier representing internal error code. | |
error_description string Detailed error message. | |
Example
{
"error": "invalid_token",
"error_description": "Provided token could not be validated."
}Oneprovider REST API not available.
| Property | Type & Description |
|---|---|
error string Identifier representing internal error code. | |
error_description string Detailed error message. | |
Example
{
"error": "invalid_token",
"error_description": "Provided token could not be validated."
}Internal server error.
| Property | Type & Description |
|---|---|
error string Identifier representing internal error code. | |
error_description string Detailed error message. | |
Example
{
"error": "invalid_token",
"error_description": "Provided token could not be validated."
}