I am coding an application that notifies events in Stack Exchange accounts. I want to notify about badges/reputation changes, and also I would like to notify whenever a new answer or comment is posted (to the user's own questions and the questions he flagged as favourites)
About the "questions activity", I think i can use the API in two ways to achieve it, but i am not sure which one would be better in order to minimize the impact on the servers.
Option 1:
- Read questions (using /users/{ids}/question) with activity changes since last update (using "min" parameter), without receiveing all the the data ( answers=false&comments=false )
- Read favourites (users/{id}/favorites) with activity changes since last update. (Parameters the same as above)
- Read timeline for those questions
(/questions/{ids}/timeline) since last update time. (using an array
with all the questions in order to receive the updates in one single API call). This call is ommited if there aren't any questions with activity in the selected period.
Option 2:
- Read all questions with activity changes since last update , including answers and comments (answers=true & comments=true and using "min")
- Read all favourites with activity changes since last update , including answers and comments (answers=true & comments=true and using "min")
Option 1 requires more API calls, but it drastically reduces the amount of data received for every call. With option 2, i can reduce the API calls, but the amount of data transferred increases a lot. (and in some tests i did, it takes much longer time because of the amount of data involved)
Reviewing the API usage questions, i think both options comply with the guidelines. The polling period is user configurable, but I don't allow it to be less than two minutes. With that period, the app would not go anywhere near the 10K daily limit. Also, i am waiting at least 5 seconds between API calls, in order not to make very consecutive calls to the API.
Which option would be better, in terms of API usage?