Skip to main content
Participant
June 6, 2023
Answered

Getting 429 when calling API from Java

  • June 6, 2023
  • 1 reply
  • 517 views

Hi, 

 

Not sure if this is the correct place to post this, if not, please let me know. 

 

I have a strange issue with the API endpoint 

 
I wrote a small Java program that gets a token and calls the above endpoint to retrieve the users from our organization, running the program once is fine, but running it a second or third time I receive a 429 with a retry-after of over 30 mins. Calling the same endpoint from Postman directly after is fine. I can't imagine hitting API limits after only doing 2 calls (retrieve an authentication token and calling the usermanagement endpoint), so is there something else going on here?
 
Happy to get some help!
 
Sietse
Correct answer Sietse290291245n2j

After some debugging it turned out that you need to send a "User-Agent" header when requesting a second access token quickly after the first request.

 

So this fails:

Request access token
Call usermanagement API with access token -> 200

Request new access token

Call usermanagement API with new access token -> 429

 

But if you do it like this it works:

Request access token

Call usermanagement API with access token -> 200

Request new access token

Call usermanagement API with new access token AND User-Agent header set -> 200

 

Interesting! But at least it works now. 

1 reply

Sietse290291245n2jAuthorCorrect answer
Participant
June 7, 2023

After some debugging it turned out that you need to send a "User-Agent" header when requesting a second access token quickly after the first request.

 

So this fails:

Request access token
Call usermanagement API with access token -> 200

Request new access token

Call usermanagement API with new access token -> 429

 

But if you do it like this it works:

Request access token

Call usermanagement API with access token -> 200

Request new access token

Call usermanagement API with new access token AND User-Agent header set -> 200

 

Interesting! But at least it works now. 

Participant
April 30, 2025

This actually works! It helped me a lot. Thanks!