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.

After encountering a throttle violation today (which I posted in another question), it occurred to me that although I've put together code to handle "backoff" conditions, and potentially throttle violation conditions (although I'm not sure what the response for this is, even) it would be nice to be able to generate these in a controlled fashion.

Does something like this exist? I'd want to be able to do something like:

/debug/backoff?time=30

Which would return a response containing a 30 second backoff request. If I violate it, it would return some error condition. This way I could make sure my implementation of the API calls handles this in a sane/acceptable fashion without violating the backoff condition. Not passing a time might cause a random backoff representing an "average" backoff.

Perhaps also:

/debug/throttle

Which would always return a throttle condition, regardless of the current state of my key. That way I could make sure I handle this situation in whatever way is appropriate.

I'm sure there's other things that would be of use for debugging, but offhand these two come to mind.

share|improve this question
2  
+1 None of my tests have ever seen the backoff parameter. My connection has way too much latency I think. –  Nathan Osman Jan 6 '12 at 3:24
add comment

1 Answer

You can use Charles to simulate any response,

It has a free 30 day trial, for Windows, Mac and Linux.

Just set a breakpoint for http://api.stackexchange/* which breaks on Response (obviously you can't use it for https, so that means it can't be used for the routes which require authentication)

You can then edit the response, (as text, not in a fancy-JSON-editing-UI) to remove fields, including fields, or complete whatever you like. Click execute and the response is "received" by the computer like normal.

share|improve this answer
2  
Yes, I was thinking I could also just set up my own debug service endpoints, but something integrated with the system would be slightly more ideal. –  agent86 Jan 6 '12 at 20:40
add comment

You must log in to answer this question.

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