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 -H "X-Auth-Token: $TOKEN" \
-X POST "https://$HOST/api/v3/oneprovider/changes/metadata/$SPACE_ID" \
-H "Content-Type: application/json" -d "@./changes_req.json"
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.
List of documents which modifications should trigger sending changes.
fileMeta object Specification of fileMeta fields to observe.
Specification of fileMeta fields to observe.
Indicates whether specified fileMeta fields should be sent on other metadata changes.
fileLocation object Specification of fileLocation fields to observe.
Specification of fileLocation fields to observe.
Indicates whether specified fileLocation fields should be sent on other metadata changes.
times object Specification of times fields to observe.
Specification of times fields to observe.
Indicates whether specified times fields should be sent on other metadata changes.
customMetadata object Specification of customMetadata fields to observe.
Specification of customMetadata fields to observe.
Indicates whether specified customMetadata fields should be sent on other metadata changes.
Xattrs names to retrieve. In case of missing fields null values are returned. In order to fetch special attributes additional keys can be specified, namely onedata_json, onedata_rdf or onedata_keyvalue (fetches all fields beside special ones).
Xattrs names to check for existence. Existence of special attributes can also be checked by specifying onedata_json, onedata_rdf or onedata_keyvalue (checks if any normal attribute exists).
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.
Unique Id of the file.
Absolute path to the file (starting with the Space name).
Sequence number (version) of the metadata document.
fileMeta object Requested fileMeta fields and additional information.
Requested fileMeta fields and additional information.
Last revision of fileMeta.
Indicates whether this metadata was deleted or not.
Indicates whether changes occured to this metadata or not.
fields object
File name.
File type.
POSIX file permissions.
File owner.
Id of provider which created this file.
Array of this file shares Ids.
Set to 'true' when file itself was deleted but file metadata must remain for some time. Otherwise false.
fileLocation object Requested fileLocation fields and additional information.
Requested fileLocation fields and additional information.
Last revision of fileLocation.
Indicates whether this metadata was deleted or not.
Indicates whether changes occured to this metadata or not.
fields object
Provider Id in which change occured.
Storage Id in which file exists.
File size.
Space Id in which space exists.
Indicates whether file was created on storage or only metadata exists.
times object Requested times fields and additional information.
Requested times fields and additional information.
Last revision of times.
Indicates whether this metadata was deleted or not.
Indicates whether changes occured to this metadata or not.
fields object
POSIX atime.
POSIX mtime.
POSIX ctime.
customMetadata object Requested customMetadata fields and additional information.
Requested customMetadata fields and additional information.
Last revision of customMetadata.
Indicates whether this metadata was deleted or not.
Indicates whether changes occured to this metadata or not.
Retrieved xattr values. In case of missing fields null values are returned.
Map indicating whether given xattrs exists or not.
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.
Identifier representing internal error code.
Detailed error message.
Example
{
"error": "invalid_token",
"error_description": "Provided token could not be validated."
}Forbidden request.
Identifier representing internal error code.
Detailed error message.
Example
{
"error": "invalid_token",
"error_description": "Provided token could not be validated."
}Oneprovider REST API not available.
Identifier representing internal error code.
Detailed error message.
Example
{
"error": "invalid_token",
"error_description": "Provided token could not be validated."
}Internal server error.
Identifier representing internal error code.
Detailed error message.
Example
{
"error": "invalid_token",
"error_description": "Provided token could not be validated."
}