r/redditdev • u/tdohz • Sep 23 '15
API updates for lock a post
We're currently beta-testing a feature called lock a post that lets moderators prevent a post from receiving any new comments. There are two API updates related to this that you should be aware of, one of which is in effect now, and one which will go into effect later, when we release this feature to everyone.
In effect now
Attempting to comment on a locked post via the API will result in the following error:
{
"json": {
"errors": [
[
"THREAD_LOCKED",
"Comments are locked.",
"parent"
]
]
}
}In effect later
Link objects will have a new boolean attribute, "locked". If "locked" is true, then new comments can't be added. This will be in effect when we release lock a post to everyone within the next couple of weeks.
View all comments
Show parent comment
4
u/tdohz Sep 24 '15
This error format is the same as what you'd get if you tried to comment on an archived thread, so the short answer is "consistency with what we already had."
As for the actual reason it's an array instead of key/value pairs - I don't actually know, but I suspect it's a historical quirk. Someone with deeper historical familiarity with our API might have more context.
It's the parameter that the error applies to, in this case "parent", which refers to the fullname of the thing you're replying to. Not especially useful for this particular error, but in other cases it lets you know if e.g. you have an error in the "to" field vs the "from" field of a private message.