2

From /answers/{id}/delete:

In practice, this method will never return an object.

For me, "in practice" means that the method will maybe return an object. But why? That's not good from an application developer's point of view. Either the method returns an object, or not, there should no in-between in my opinion. That's just a pain to test each time if an object is received, or not.

Am I understanding it correctly?

1
  • Near as I can tell, that particular doc page doesn't work at all. Plugged in valid values and no results, nor errors, were issued. The route works as expected from my own app. Commented Jul 4, 2017 at 3:56

1 Answer 1

2

Strictly speaking, that line is incorrect. The method will always return a JSON object (barring certain server failures).

But the items array will be empty or missing.

On success, the default object looks like:

{
    items: [],
    has_more: false,
    quota_max: 10000,
    quota_remaining: 9998
}

And on (normal) failure, it looks like:

{
    error_id: 407,
    error_message: "Answer not found",
    error_name: "write_failed"
}
//or
{
    error_id: 407,
    error_message: "Only answer owners can delete their answers with this method",
    error_name: "write_failed"
}
//or
{
    error_id: 403,
    error_message: "Applications must have a registered Stack Apps post to write",
    error_name: "access_denied"
}
// etc., etc.
2
  • So basically, the "in practice" is misleading here.
    – Rakete1111
    Commented Jul 4, 2017 at 5:21
  • Yeah, a little. I imagine that whoever wrote it was just less precise than I would prefer, and perhaps rushed. Commented Jul 4, 2017 at 5:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .