You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to retrieve X-RateLimit params through the API? #35
I was in contact with campaign monitor, they say that they don't provide examples.
However I think you have to program it yourself, e.g. like this:
Enumeration headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String key = (String) headerNames.nextElement();
String value = request.getHeader(key);
map.put(key, value);
}
// and now check map for the X-Rate* keys
Hi. Whilst I have not tested this assumption, if you exceed the rate limit you should get a 429 response (as @baszero stated), this non 200 response should cause a CreateSendException to be raised containing the 429 code. You could then read this, and back off. It's not an ideal solution, but it does get you some of the way there.
The Jersey client library doesn't make it easy to expose the response headers like you need, it looks like it would require some refactoring of the wrapper.
Activity
baszero commentedon Oct 3, 2016
I noticed that the Rate Limits are provided in the
HttpResponseas HTTP Header Parameters:As of Campaign Monitor support, the Rate Limit parameters are provided in EACH response regardless of the status code, e.g.:
So my question is: How can I access the response object in order to parse the HTTP Header parameters and finde these values?
[-]Samples for MessageSent[] with focus on Rate Limiting[/-][+]How to retrieve X-RateLimit params through the API?[/+]shahidt commentedon Feb 5, 2017
I am looking for a solution to this problem as well. Any luck?
baszero commentedon Feb 6, 2017
I was in contact with campaign monitor, they say that they don't provide examples.
However I think you have to program it yourself, e.g. like this:
shahidt commentedon Feb 6, 2017
Would I need to put that in the wrapper around where the requests are made? I was hoping to not touch the original set of wrapper codes at all.
baszero commentedon Feb 6, 2017
in your own code, you call the API, and you parse the response, if possible. I didn't try it, it's just what I'd try first.
richardbremner commentedon Feb 6, 2017
Hi. Whilst I have not tested this assumption, if you exceed the rate limit you should get a 429 response (as @baszero stated), this non 200 response should cause a CreateSendException to be raised containing the 429 code. You could then read this, and back off. It's not an ideal solution, but it does get you some of the way there.
The Jersey client library doesn't make it easy to expose the response headers like you need, it looks like it would require some refactoring of the wrapper.