3

Probably this is a documentation fault.

For the search method, the parameter list doesn't say anything about an optional body, but looking at the Returns description shows:

"body": {
        "description": "body of this post, rendered as HTML",
        "values": "string",
        "optional": true,
        "suggested_buffer_size": 30000
      }

However, doing http://api.stackoverflow.com/1.0/search?tagged=linq-to-sql&pagesize=10&body=true doesn't return the body.

I suppose it was removed from the implementation, and that part of the documentation didn't get updated. Is it so? Or should I use something different than body=true?

1
  • +1 - good catch, inconsistencies like this can be quite confusing while starting to work with an API indeed! Commented Sep 23, 2010 at 7:39

1 Answer 1

3

The body of a post is optionally returned on all methods that return "posts."

/questions, /questions/{id}/answers, /users/{id}/questions, /answers/{id}, etc. all return the same "post object" I guess you'd say. The same code can be used to parse the post subset of fields, anyway. Kind of complicated, unfortunately.

However, since /search is so expensive we don't actually return the body, ever. The documentation is (really obtusely) saying "body is optionally returned if you ask for it, but there's no way to ask for it."

The ambiguity is a consequence of our auto-magic documentation generation, something that's probably going to go away in a subsequent version of the API (for reasons like this) but for now we're stuck with it.

You must log in to answer this question.

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