3

To get all the questions that I have asked, I am using Stack Exchange API, I am using /me/questions. When only total is requested, order and sort are also given as parameters in the query string. It is unnecessary. Should there be some modifications in the API, to not have these unnecessary parameters when total is requested? Also, in the doc page?

2

No unnecessary parameters are required. order and sort are always optional.

You can see this with these direct API calls:

It's hard to demonstrate a live link for /me/questions, since it requires an access token, but if you call that route from an app or script, you'll see that order and sort are not required.

As for the doc pages, they automatically add those parameters as a convenience, not because they are required by the actual API.

  • When requesting only total, the unnecessary parameters don't come under 'convenience' category. Also, the doc page should be modified appropriately, i.e, the two parameters should be disabled. – amit jha Jun 25 '15 at 8:58
  • Was the previous comment acceptance of the poor documentation? Also, correct documentation would help future programmers. Is incomplete, erroneous documentation of any use? I am from India, where we are expected to be flexible in every position. – amit jha Jun 25 '15 at 9:19
  • The documentation is fine. The convenient demo tool is not the documentation; nor is it erroneous in any way (in this instance). In fact, by providing those optional values explicitly: (1) it illustrates the default behavior/sort and (2) it encourages the developer to consider and specify the sort. This is always a best practice and can help prevent "time bomb code". – Brock Adams Jun 25 '15 at 9:27

You must log in to answer this question.

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