You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
API: No way to retrieve events later than a certain point #405
The current API only takes the parameters page number and number of entries to influence the subset of entries returned.
For a client that is not suitable. We need an API that provides all new entries that came after a certain point of time. That can either be done through ID or timestamp. The client needs a way to specify a number of events to be returned at a time (already there), but also a way to query how many new entries are new after a certain point.
Don't really care too much, which route we go. Either OCS or WebDAV
OCS has the pro that it exists already, con it needs to be adjusted a lot to allow starting by timestamp and more, so we either break the existing endpoint or need to make a new one, so the already-existing benefit is gone.
Client maintains a local storage of the events to be able to display them quickly and also in offline mode
From that local storage, client can find out the latest event it knows, ie. the highest timestamp, or maybe better id.
to fetch new events from the server, it sends the last known highest timestamp along and the server returns the new events that came after that.
To not get completely flooded client sends a maximum of events per call, and server replies accordingly with that amount maximum. If there are more that has to be indicated somehow.
Well the current API is like a paged search. Just like you would get from a book or in the web ui.
However the local storing and offline thing makes sense to me and I also see no other way then having a "I know everything up to activity #X" approach.
Header specifies the first known ID (in case the given one was pruned (time))
Header specifies if there are more activities (only bool, not a number or something)
Client reads header from 3 and throws away all activities before it.
Client reads header from 4 and then calls again with the newest ID from the previous call
Questions
What happens when disabling an activity type in the personal settings? There might be invalid activities in the middle, that need to be deleted, but the server does not know which activities are in the client that should be deleted as well.
Should we also send a list of "activity types to keep", and the client drops activities that are not set anymore?
Enabling a type is not that big of a problem, because the server may not have stored the action, but it can happen that an activity is in the WebUI which the client is missing, because it didn't sync back then. But I'd say "sorry, this setting may not be retro-active"
Request for all activities
GET /cloud/activity
With type filter
GET /cloud/activity/:filter
Parameters
Name
Type
Description
since
int (Optional)
The integer ID of the last activity that you’ve seen.
limit
int (Optional)
How many activities should be returned (Default: 50)
object_type
string (Optional)
Allows to filter the activities to a given object. May only appear together with object_id
object_id
string (Optional)
Allows to filter the activities to a given object. May only appear together with object_type
sort
string - asc or desc
Should activities be given ascending or descending (from the since) (Default: desc)
In case the since parameter was not known, the header gives the first known activity ID
X-Activity-First-Known: 370
Activity element
Field name
Type
Value description
activity_id
int
Autoincrement value from the database
timestamp
int
UNIX timestamp of the activity
app
string
App that created the activity (e.g. 'files', 'files_sharing', etc.)
type
string
For most files related activities this is the action that was performed on the file/folder (e.g. 'file_changed', 'file_created' (same is used for both, file and folder)), other apps use other strings (e.g. 'announcementcenter')
user
string (Optional)
User ID of the user that triggered/created this activity (can also be empty in case of public link/remote share action)
affecteduser
string
User ID of the user that received this activity (always the same)
Array with one array per parameter, each parameter array has the key 'type' and 'value'. Value is an array-of-parameters in case of type collection and a string otherwise
message
string (Optional)
Untranslated arbitrary message (unused by core apps)
messageparams
array
See subjectparams
link
string (Optional)
A full URL pointing to a suitable location (e.g. 'http://localhost/ownCloud/master/core/index.php/apps/files/?dir=%2Ffolder' in case the folder got created)
object_type
string (Optional)
Type of the object this activity is about (e.g. 'files' is used for files and folders)
object_id
string (Optional)
ID of the object this activity is about (e.g. ID in the file cache is used for files and folders)
object_name
string (Optional)
Name of the object this activity is about (e.g. for files it's the relative path to the user's root: '/folder/.travis.yml')
subjectformatted
array
subjectformatted.trimmed
string
Short version of the subject (only filename instead of path, etc. You changed abc.txt)
subjectformatted.full
string
Long version of the subject (e.g. You changed path/to/file/abc.txt)
subjectformatted.markup
array
subjectformatted.markup.trimmed
string
Short version of the subject (only filename instead of path, etc. You changed <a class="filename has-tooltip" href="/ownCloud/master/core/index.php/apps/files?dir=%2Ffolder&scrollto=abc.txt" title="in path/to/file">abc.txt</a>)
subjectformatted.markup.full
string
Short version of the subject (e.g. You changed <a class="filename has-tooltip" href="/ownCloud/master/core/index.php/apps/files?dir=%2Ffolder&scrollto=abc.txt">path/to/fileabc.txt</a>)
messageformatted
array
See subjectformatted and it's children (unused by core apps, values can be very long)
activity_ids
array of int (Optional)
Array of activity_ids that have been grouped into this activity
In case the endpoint returns more fields, they should be ignored and are deprecated (only for backwards compatibility usage) or internal.
How do we specify how many results come back with a call to the new api?
I don't think using headers here is nice. Can we add the next-link and the there-is-more to the json doc?
What is the difference between trimmed and full for message and subject?
We should not duplicate the strings with markups in the result. Let's use an Accept header to let each client specify the format it wants back.
I think object_type and object_name are redundant, as they are already there as "subjectparams". How about adding the object_id to the subject params as well?
How do we specify how many results come back with a call to the new api?
Missed it, added now:
Name
Type
Description
limit
int (Optional)
How many activities should be returned (Default: 50)
I don't think using headers here is nice. Can we add the next-link and the there-is-more to the json doc?
Well then we need to wrap the result once more, because stuff can not be added to the meta setion, resulting in: ocs > data > activities > element+
What is the difference between trimmed and full for message and subject?
As per description above:
trimmed - Short version of the subject (only filename instead of path, etc. You changed abc.txt)
full - Long version of the subject (e.g. You changed path/to/file/abc.txt)
We should not duplicate the strings with markups in the result. Let's use an Accept header to let each client specify the format it wants back.
Not possible, because the header is used by OCS to decide if json or xml is to be returned.
I think object_type and object_name are redundant, as they are already there as "subjectparams". How about adding the object_id to the subject params as well?
No, only in some cases. When stuff is grouped (instead of a single activity) or when there are more parameters, they are not equal anymore. But yes, object_id will most likely be added to the path for future activities
In the interim between 9 and 9.1, a draft standard from W3C emerged. There is the opportunity to use this standard for this activity stream, rather than implementing our own. As it is in draft, we can put in feature requests.
Note: Types of activity stream are defined by W3C, and we need to correlate ownCloud values to W3C pre-defined types.
Plan for oC
Support the old API with the new W3C API, and also introduce a way to jump back and fetch activities from a certain time.
Any other W3C API specification support is for a version 2.0.
Activity
DeepDiver1975 commentedon Oct 8, 2015
Reading this I assume you intend to store the activities locally in the clients and want to check in a given interval for new activities - right?
So basically this would be an activity sync mechanism.
nickvergessen commentedon Oct 8, 2015
Don't really care too much, which route we go. Either OCS or WebDAV
OCS has the pro that it exists already, con it needs to be adjusted a lot to allow starting by timestamp and more, so we either break the existing endpoint or need to make a new one, so the already-existing benefit is gone.
Anyone with power please make the call.
DeepDiver1975 commentedon Oct 8, 2015
Protocol is to be choosen at a later stage - for now I want to understand the client's expectations and it's operations.
@dragotin
dragotin commentedon Oct 8, 2015
I was thinking about this:
But maybe I misunderstood the API completely?
nickvergessen commentedon Oct 8, 2015
Well the current API is like a paged search. Just like you would get from a book or in the web ui.
However the local storing and offline thing makes sense to me and I also see no other way then having a "I know everything up to activity #X" approach.
karlitschek commentedon Oct 8, 2015
@nickvergessen OCS please. Let's stay at the current route with the current API unless a change is absolutely necessary.
nickvergessen commentedon Oct 30, 2015
Endpoint
Questions
Request for all activities
With type filter
Parameters
sincelimitobject_typeobject_idobject_idobject_typesortascordescsince) (Default:desc)Status
200 OK[{Activity element}(,{Activity element})]304 Not Modified[]403 Forbidden404 Not FoundHeaders
Link for the next request
Already includes all parameters
First known activity
In case the
sinceparameter was not known, the header gives the first known activity IDActivity element
activity_idtimestampapp'files','files_sharing', etc.)type'file_changed','file_created'(same is used for both, file and folder)), other apps use other strings (e.g.'announcementcenter')useraffectedusersubject'changed_self','changed_by')subjectparams'type'and'value'. Value is an array-of-parameters in case of typecollectionand a string otherwisemessagemessageparamssubjectparamslink'http://localhost/ownCloud/master/core/index.php/apps/files/?dir=%2Ffolder'in case the folder got created)object_type'files'is used for files and folders)object_idobject_name'/folder/.travis.yml')subjectformattedsubjectformatted.trimmedYou changed abc.txt)subjectformatted.fullYou changed path/to/file/abc.txt)subjectformatted.markupsubjectformatted.markup.trimmedYou changed <a class="filename has-tooltip" href="/ownCloud/master/core/index.php/apps/files?dir=%2Ffolder&scrollto=abc.txt" title="in path/to/file">abc.txt</a>)subjectformatted.markup.fullYou changed <a class="filename has-tooltip" href="/ownCloud/master/core/index.php/apps/files?dir=%2Ffolder&scrollto=abc.txt">path/to/fileabc.txt</a>)messageformattedsubjectformattedand it's children (unused by core apps, values can be very long)activity_idsactivity_ids that have been grouped into this activityIn case the endpoint returns more fields, they should be ignored and are deprecated (only for backwards compatibility usage) or internal.
Example
{ "activity_id": 1, "timestamp": 1446137950, "app": "files", "type": "file_deleted", "user": "admin", "affecteduser": "admin", "subject": "deleted_self", "subjectparams": [ { "value": "\/welcome.txt", "type": "file" } ], "message": "", "messageparams": [ ], "link": "", "object_type": "files", "object_id": 3, "object_name": "\/welcome.txt", "subjectformatted": { "trimmed": "You deleted welcome.txt", "full": "You deleted path/to/file/welcome.txt", "markup": { "trimmed": "You deleted <a class=\"filename\" href=\"\/ownCloud\/master\/core\/index.php\/apps\/files?dir=%2F&scrollto=welcome.txt.d1446137950&view=trashbin\" title="in path/to/file">welcome.txt<\/a>", "full": "You deleted <a class=\"filename\" href=\"\/ownCloud\/master\/core\/index.php\/apps\/files?dir=%2F&scrollto=welcome.txt.d1446137950&view=trashbin\"path/to/file/>welcome.txt<\/a>" } }, "messageformatted": { "trimmed": "", "full": "", "markup": { "trimmed": "", "full": "" } } }Usages
subjectformatted.markup.trimmedandmessageformatted.markup.trimmedsubjectformatted.fullandmessageformatted.fullNotes
The endpoint does not yet output that information
DeepDiver1975 commentedon Oct 30, 2015
THX @nickvergessen
We need to specify the url parameters of the request as well.
May I suggest to add some example code like https://developer.github.com/v3/repos/#get ? THX
nickvergessen commentedon Oct 30, 2015
Updated
dragotin commentedon Nov 2, 2015
Nice, this looks reasonable.
Some questions/remarks:
trimmedandfullfor message and subject?Acceptheader to let each client specify the format it wants back.DeepDiver1975 commentedon Nov 3, 2015
this approach follows a common standard - https://tools.ietf.org/html/rfc5988 - used by e.g. Github as well
DeepDiver1975 commentedon Nov 3, 2015
Accept is to specify the full body format - not individual elements
nickvergessen commentedon Nov 3, 2015
Missed it, added now:
Well then we need to wrap the result once more, because stuff can not be added to the meta setion, resulting in:
ocs > data > activities > element+As per description above:
Not possible, because the header is used by OCS to decide if json or xml is to be returned.
No, only in some cases. When stuff is grouped (instead of a single activity) or when there are more parameters, they are not equal anymore. But yes, object_id will most likely be added to the path for future activities
18 remaining items
karlitschek commentedon Feb 23, 2016
agreed. let restart this for 9.1
dragotin commentedon Mar 9, 2016
@karlitschek mentioned something about a public standard that could be used here.
MTRichards commentedon Apr 1, 2016
In the interim between 9 and 9.1, a draft standard from W3C emerged. There is the opportunity to use this standard for this activity stream, rather than implementing our own. As it is in draft, we can put in feature requests.
Note: Types of activity stream are defined by W3C, and we need to correlate ownCloud values to W3C pre-defined types.
Plan for oC
Any other W3C API specification support is for a version 2.0.
MTRichards commentedon Apr 1, 2016
Estimation: 2 weeks
PVince81 commentedon Apr 6, 2017
I'm moving this to backlog for now until this gets rescheduled.
cc @guruz to recheck this old requirement
cc @pmaier1