2

I've tried adding filter=total and filter=withbody in the same request but get the following error:

{"error_id":400,"error_message":"Invalid filter specified","error_name":"bad_parameter"}

How should I format an API request to /questions with two filters specified?

I also tried filter="withbody, total".

1 Answer 1

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 you can see in action with queries like:

/2.2/search?pagesize=1&intitle=orange& ... &filter=!BHTP)ZqRO*RussQSam5gFh2.5-X*0T

2
  • Thanks - that worked for me. How long does the filter stay valid for?
    – codecowboy
    Commented Aug 10, 2016 at 9:10
  • 1
    It should stay valid indefinitely (mine do). There is an outside chance that some future API version may make some filters obsolete, but you'd get ample warning if that was to happen. Commented Aug 10, 2016 at 9:13

You must log in to answer this question.

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