Hot answers tagged

7

This is what custom filters are for. For example, if you append &filter=!BGRhem4Z)WIti9lP55R*tgr(Jq_fHC to your query, above, you will get results without upvote_count, downvote_count, or owner information. (The first two aren't included by default anyway.) An easy way to create a filter is to use the filter-edit tool, on the appropriate doc page for ...


6

You can create and edit filters from the documentation page of the API endpoint. So you start at the Index of all endpoints. There you'll find /users/{id}/answers. On the right at the top of the parameter block you'll find the filter dialog: When you click the [edit] link the filter dialog opens: Where you can expand any the [types] provided by this ...


5

The most straightforward way to get the body is to use the named withbody filter, which you pass in as the value of the filter parameter (example). This will give you all of the default fields, along with the post body. You can also create a custom filter that passes back question.body and answer.body where appropriate along with your select choice of other ...


3

"A number of" might be a bit of a misnomer, as there are a whopping four standard ones: From the filters documentation: default, each type documents which fields are returned under the default filter (for example, answers). withbody, which is default plus the *.body fields none, which is empty total, which includes just .total The page also ...


3

This appears to be closely related to the bug: Why is comment_count=1 (incorrectly) when this particular filter is used?. The workaround from there -- altering the filter by: selecting comment.comment_id and selecting question.comments appears to work in this case too. (Although, in at least one instance, it seemed to need question_id as well. But this ...


3

The key mistake here is neglecting the Wrapper Object, and this is a big flaw with the filter documentation. The wrapper is the box that everything you get from the API comes in. You always get the wrapper object except in the grossest of server/API errors. (In your case you were getting a wrapper of {}.) The stuff you care about, the payload, is the ...


2

Yes. You can pass a filter, and you should (for all the standard reasons). First: On the doc page, changing the filter or preview, etc. will not change the URL for write methods. Write methods must POST to the API, which means that parameters are supposed to be sent form encoded, not in the URL. (This API bakes some things, like post ID, into the route. ...


2

No, you cannot pass multiple filters. But the good news is you don't need to. Just create a custom filter. In your case, you might first set the edit tool to use withbody, and then further edit the filter to check the box next to .wrapper -> total, in the edit tool. When you do that, you get a custom filter like !BHTP)ZqRO*RussQSam5gFh2.5-X*0T -- which ...


2

I have struggled with Stack Exchange API filters too, when I tried to incorporate up_vote_count, down_vote_count and view_count attributes in my user response object. I visited this page of the Stack Exchange API to create my filter (same as you). I just wanted to include my three attributes and thus set the following parameters: include: user....


1

I was able to deduce an answer by 'reverse-engineering' (sort of) the default filter: /2.2/filters/default this gives { "items": [ { "included_fields": [ ".backoff", ".error_id", ".error_message", ".error_name", ".has_more", ".items", ".quota_max", ".quota_remaining", "...


1

Confirmed. The path seems to use a default sort key on last_activity_date and that corrupts the filter somehow. (I checked for caching by waiting more than 1 minute and by varying the question ids.) If I create a new filter and explicitly specify a sort key on votes, it worked for a time or two (no last_activity_date returned). But somehow it still inserts ...


Only top voted, non community-wiki answers of a minimum length are eligible