Cocoa (
momijizukamori) wrote in
dw_dev2017-10-10 10:29 pm
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
![[site community profile]](https://www.dreamwidth.org/img/comm_staff.png)
Entry tags:
API wishlist?
So my workplace gives us a chance twice a year to work on anything we want for a few days, work-related or otherwise, and I thought I'd use some of my time to actually get the new API into a state where we can make it live. With that in mind! What endpoints would you like to see implemented? We're making this Swagger/OpenAPI-compliant, so everything takes JSON as arguments and return JSON formatted data. Stuff already on the list to do or partially done:
/api/v1/users/{username} - GET, shows info about the user (specific info TBD; subset of profile, probably?)
/api/v1/users/{username}/icons - GET, lists icons
/api/v1/users/{username}/icons/{iconid} - GET, returns icon data
/api/v1/users/{username}/journals - GET, returns list of journals with write access.
-- for now, returns only user's primary journal
/api/v1/journals/{username}/accesslists - GET, list of access lists for journal
/api/v1/journals/{username}/tags - GET, list of tags for journal
/api/v1/journals/{username}/xpostaccounts - GET list of xpost accounts
/api/v1/moods - GET list of moods
/api/v1/commentsettings - GET list of allowed comment settings
/api/v1/journals/{username}/entries - POST new entry, GET list of recent entries
/api/v1/journals/{username}/entries/{id} - POST edit entry, GET specific entry
/api/v1/journals/{username}/files - POST new file
/api/v1/spec - GET, returns a description of the API
(Mark and D, as usual, get the final say - some stuff people want may end up being security/privacy risks in non-obvious ways)
/api/v1/users/{username} - GET, shows info about the user (specific info TBD; subset of profile, probably?)
/api/v1/users/{username}/icons - GET, lists icons
/api/v1/users/{username}/icons/{iconid} - GET, returns icon data
/api/v1/users/{username}/journals - GET, returns list of journals with write access.
-- for now, returns only user's primary journal
/api/v1/journals/{username}/accesslists - GET, list of access lists for journal
/api/v1/journals/{username}/tags - GET, list of tags for journal
/api/v1/journals/{username}/xpostaccounts - GET list of xpost accounts
/api/v1/moods - GET list of moods
/api/v1/commentsettings - GET list of allowed comment settings
/api/v1/journals/{username}/entries - POST new entry, GET list of recent entries
/api/v1/journals/{username}/entries/{id} - POST edit entry, GET specific entry
/api/v1/journals/{username}/files - POST new file
/api/v1/spec - GET, returns a description of the API
(Mark and D, as usual, get the final say - some stuff people want may end up being security/privacy risks in non-obvious ways)
no subject
no subject
Ah, yeah, I forgot to put login/logout there because it's likely to be a slightly different beast - what I've got written already works with regular auth cookies, but obviously that's not the best option for an API :)
no subject
As it happens now's kinda bad for me – this is interrupting my procrastination of other things. What's your timeline for comments being useful? Can you give us a deadline for getting back to you?
no subject
My big push is going to be end of this week/this weekend, but I doubt I'll get EVERYTHING done so - whenever you've got time?
Access to the accesslist membership lists?
Need to think through how this will work with comms
(no subject)
(no subject)
(no subject)
(no subject)
(no subject)
(no subject)
(no subject)
no subject
My suggestion is: 'list of posts and comments that have been created, modified or deleted since <time>', where <time> is something that can be used to reliably avoid gaps; it might be a sequence number rather than an actual time. Could be multiple queries for different kinds of object, with the caveat that nobody wants to poll every entry in a journal to see if there are changes to comments.
Obviously what I'm interested in here is incremental journal backups l-)
no subject
Hm, I'll look into it! This may end up being better-handled in other ways, though - I know we have at least partial code for 'back up my whole journal' already done somewhere, and I'm guessing it may use DB flags like the importer does, which aren't exposed outside of the server backend.
no subject
no subject
- Number of new entries on reading page since time x
- Number of new entries on subscription filter y since time x
- List of subscription filters for my account
Those would allow displaying the number of new posts on mobile's front screen easily and setting up which number should be displayed on the mobile app.
Using push notifications for that would be extra nice, but I know nothing about them, being a noob. :)
no subject
I will add those to the list! I'm not sure push notifs would be possible under this framework, because that requires the server to make outbound contact all the time, instead of waiting on requests, and I could see that getting expensive quickly, but the others are definitely possible.
(no subject)
(no subject)
(no subject)
Push notification helpers: Prowl (for iOS), and Notify My Android
no subject
Track.
AKA as a user I'd like to get real push notifications for tracked items and be able to view new comments.
no subject
Also, I'm concerned that if the API manages to cause clients to happen, and people start DWing from the phones or desktop apps or whatever, and those don't support the inbox, it will become even more impossible to direct-message people, because those users will never see anything about it, unless they have turned on email notification (which apparently is not on by default?)
I don't just want the API to support the inbox, I kinda want inbox support to be mandatory for DW posting/reading clients. Because I'm afraid that otherwise clients will turn the inbox into dead.letter.
(no subject)
no subject
no subject
Those options are definitely possible! Though as I mentioned in another comment, I think push notifs may be too computationally expensive - that's a call for Mark to make
(no subject)
no subject
no subject
Oh, for sure! Part of the nice thing about OpenAPI + the way I've started implementing it is that it's partially self-documenting - the files that generate the docs are the same ones that generate the actual code. A human still has to add the descriptive text that the server doesn't need, but they can't actually get totally unsync'd, and will always at least have paths/methods/what it takes/what it gives back. The current XML-RPC API and the docs that go with it, uh, leave a lot to be desired.
(no subject)
(no subject)
no subject
A second level down might also be nice:
given (auth, user, tag), get a list of entries
given (auth, user, accesslist), get a list of entries.
given (auth, user, entry), get previous or next entries.
Auth here is the identity to query using, since the results of those matter based on who you are.
Some more queries I find myself doing manually that might be nice to have a simpler way to do:
1. Translating between date and entries, in both directions. (It's one-to-many, of course.) Even cooler would be "get entries between START and END", but that's fancier.
2. Something regarding polls. Probably the ability to map entry to poll ID, then querying by poll ID to get poll results/status. (I put a poll in almost every entry, but I am...not typical.)
no subject
no subject
Definitely doable!
no subject
I may have missed it, but I don't see anything here for retrieving, posting, or editing comments.
Can't wait to get my hands on this. Also, thanks for pointing me at Swagger/OpenAPI -- that's really useful.
no subject
You didn't want! The list wasn't intended to be complete, just 'what's happening first' - about half of it already has working code in dev.
no subject
My suggestion:
Force the API to recognize security levels (filters) on posts. As in, if there is no implementation of filter levels, the only posts the script/program can see are public ones.
Reason:
There was some hullabaloo a LONG time ago about one of the various third party LJ apps (I don't remember which one, it was at least a decade ago that I heard about this) being able to *completely* bypass post filters/security levels, allowing anyone using that particular app to see *any* post on a journal, regardless of whether the user was included on a filter for that post or not.
no subject
(no subject)
(no subject)
(no subject)
(no subject)
(no subject)
no subject
This is great news, since some code I used in the past no longer seems to work for dw-free.
Thank you for taking this initiative. I wish you the best of luck!
Where will you make the code available?
no subject
(no subject)
(no subject)
(no subject)
(no subject)
(no subject)
(no subject)
no subject
some specific params for GET /api/v1/journals/{username}/entries:
- number of entries to fetch
- offset (so it's possible to get entries in batches)
- from & to timestamps (to get entries from a specific timeframe)
- fetch posts by tag
/api/v1/comments/{post_id} - GET comments on a post, with these params:
- number of comments to fetch
- offset
- from & to timestamps
Generally, I'm hoping for more "frontend" type of endpoints that would make the public data available for automatization/processing - i.e. backups, import/export. The old LJ API is geared toward content-generating apps, I'd love something more akin to Tumblr's API.
no subject
- number of comments to fetch
- offset
- from & to timestamps
Oooh, also a param for fetching just unscreened comments.
(no subject)
(no subject)
/api/v1/journals/{username}/entries/{id}
Re: /api/v1/journals/{username}/entries/{id}
Yeah, the idea with POST was basically to mirror the way on-site edit functionality works (with the bonus of being able to co-opt a bunch of the existing pathways for doing that). I hadn't considered PATCH, though since writing this initial spec we've swapped to OpenAPI3.0 which is a lot more flexible about content-type.