Page MenuHomePhabricator

Create user interaction endpoint
Closed, ResolvedPublic5 Estimated Story Points

Description

This endpoint should return all the revisions performed by two users on overlapping articles for a specific wiki within a specified time range.
In other words, it should accept the following parameters:

  • user: string|string|..string
  • wiki
  • start_date
  • end_date
  • limit

It should return results in whatever format will be easiest for the existing InteractionTimeline codebase to process.

Upstream
T186556: Add a parameter Usercontribs API to limit results to contributions to pages that a list of users have edited

Event Timeline

I would recommend doing something like user[] as the parameter, so you get an array of users. This way the endpoint will already support more than one user. :)

http://example.com/?user[]=Apples&user[]=Bananas

I would recommend doing something like user[] as the parameter, so you get an array of users. This way the endpoint will already support more than one user. :)

http://example.com/?user[]=Apples&user[]=Bananas

Or the way MediaWiki does it, where user names are separated by pipes: user=Apples|Bananas

Yes, I'll update the description to reflect this.
I think using user=Apples|Bananas is a known format for anyone using MediaWiki API so let's stick to that.

What about pagination? We should probably include that here.

What about pagination? We should probably include that here.

Oh yeah... we kinda need that. :P

I've only ever done page, limit and count works too.... regardless, if it's sequential I can make more than one request at a time from the front end. MediaWiki's continue doesn't allow that.

@dbarratt I don't think we are gonna need concurrent requests to fetch the data, plus token based pagination is the way to go.

It should return results in whatever format will be easiest for the existing InteractionTimeline codebase to process.

We need to define this.

TBolliger set the point value for this task to 5.Feb 1 2018, 7:57 PM

@dbarratt I don't think we are gonna need concurrent requests to fetch the data, plus token based pagination is the way to go.

Upon further reading, you're right, token based pagination is the safest choice.

It should return results in whatever format will be easiest for the existing InteractionTimeline codebase to process.

We need to define this.

You could return it in the same format as
https://test.wikipedia.org/w/api.php?action=query&list=usercontribs&ucuser=Sweets%20lover&ucdir=newer&origin=*&formatversion=2
(although, we don't need all of the data that is in there)
or you could also just return a simple collection (array) of objects in this shape:
https://github.com/wikimedia/InteractionTimeline/blob/master/client/src/entities/revision.js
alternatively, if you want to go crazy you could return it in something like JSON API, which has libraries for PHP as well as JavaScript.