• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Getting 429 when calling API from Java

New Here ,
Jun 06, 2023 Jun 06, 2023

Copy link to clipboard

Copied

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
TOPICS
Teams

Views

226

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

New Here , Jun 07, 2023 Jun 07, 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 he

...

Votes

Translate

Translate
New Here ,
Jun 07, 2023 Jun 07, 2023

Copy link to clipboard

Copied

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 07, 2023 Jun 07, 2023

Copy link to clipboard

Copied

LATEST

thanks for the update.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines