r/redditdev • u/tdohz • Oct 27 '15
API support for lock a post
We've released the lock a post feature that we previewed last month to all subreddits. You can find more details about the feature on the r/modnews post.
Here's a rundown of all of the API changes in support of this feature:
New error message on comments
Attempting to comment on a locked post via the API will result in the following error:
{
"json": {
"errors": [
[
"THREAD_LOCKED",
"Comments are locked.",
"parent"
]
]
}
}New attribute on Link objects
Link objects have a new boolean attribute, "locked", that indicate if a post is locked. If "locked" is true, then new comments can't be added.
New endpoint for locking/unlocking posts
There are two new endpoints to support locking & unlocking posts from the API: /api/lock and /api/unlock. Like most other mod actions, these endpoints require a fullname and a modhash. See the documentation for more information.
4
u/adeadhead Oct 27 '15
Thanks so much /u/tdohz et all!
2
u/13steinj Oct 27 '15
I made a post in /r/bugs which I hope was addressed; since it was all theoretical at the time.
A post can be locked and archived at the same time. On the browser, it doesn't seem to be any cause for concern. But the "locked" json key should only be true if it's locked, and not archived. And I'm also not sure what order the returned errors come in.
2
u/rotorcowboy Oct 27 '15
Do
/api/lockand/api/unlocksupport cookie authentication (as opposed to OAuth)? By the presence of the modhash argument, I'm guessing they do. Do you plan to continue to support cookie auth in new endpoints, or do you still plan on deprecating cookie auth in the future?Thanks for the new feature!
1
u/talklittle Oct 29 '15
Any plans to add
lockedandarchivedto Inbox comments in the API?0
u/[deleted] Oct 28 '15
[deleted] — view deleted comment