Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

I am trying to build an RSS feed that includes any/all questions that I have answered, and been accepted as the correct answer.

I am running into an issue where I'm sending too many requests and wonder if there is a more simple way to accomplish it. (I am using stackphp)

Steps I am taking

  1. Get My profile (for total answer count)
  2. Get All my answers
  3. Loop through All answers (using total count/pagesize to iterate through multiple pages if need be. And filter answers (checking if accepted)
  4. Build a Questions array by Grabbing each question associated with each answer ($answer['question_id']) individually

Then I (theoretically) will have an answers array and a questions array with corresponding keys that will hold only accepted answers/questions

It gets through a cetertain number of requests and then fails, I believe I'm overloading the API (I'm using an API key).

Is there any way to (through the api) ask to have the question body/title included with answers? And/or is there a better way to approach this that I'm not seeing?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Note: I'm the author of stack.PHP.

You're likely running into rate limit issues. The API only allows you to make som many requests per second. Quoting from the question I linked to:

The API will cut you off if you make more than 30 requests over 5 seconds to any single endpoint.

Based on past experience, what you need to do is make sure that there is a 100ms delay between requests (I know, that's nowhere near 30/s but there have been issues with that in the past).

share|improve this answer
    
that was it! thanks, btw you might look in your UserExchange file, I think you are re-defaulting the ttl to 10 in the UserExchange constructor. Had to fix that to get it to work –  jondavidjohn Feb 14 '11 at 20:34
    
@jon: Yes, thank you - I have already fixed it in the repository but that fix hasn't made it to the downloadable archives yet :) –  Nathan Osman Feb 14 '11 at 20:39
add comment

You must log in to answer this question.

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