SharePoint returns TOO MANY REQUESTS for 401 HTTP code
Category
- [ ] Question
- [ ] Typo
- [x] Bug
- [ ] Additional article idea
I develop simple application for fetching data in SharePoint sites. I use requests from SharePoint REST API for getting SharePoint Sites info (both for Team Sites and Communication Sites). Also I use such API for getting info about files and folders in SharePoint document libraries.
Expected or Desired Behavior
Sometimes I get throttling responses from Microsoft with 429 HTTP code and
"429 TOO MANY REQUESTS" message in reply body.
Observed Behavior
But recently I noticed strange behavior: "429 TOO MANY REQUESTS" message returned in reply body but HTTP status code is 401 (which status for UNAUTHORIZED request). However I handle 401 HTTP status code in different way and this totally break the logic of my service and 401 HTTP status code in general.
I think it's not normal behavior, is it? How can I determine if 401 HTTP status code states for throttling of for unauthorized request? Straightforward reply body parsing is not a good approach as I think.
Just to help diagnose this, what REST end point were you calling that returned a 401?
I can see this problem for requests related to all REST endpoints no meter if I work with files and folders or with lists: e. g. I can get this "bad" reply when I fetch folders in doc lib using this endpoints http://<site_url>/_api/web/GetFolderByServerRelativeUrl(<folder_url>) http://<site_url>/_api/web/GetFolderById(<folder_guid>)/Folders
I see this problem more often than before. Any progress on this?
@Vasyl18
For 429 error, it definitely is throttling issue. You can have look throttling docs
From developer point of view. The reason you have received 401 error might be you have too many 429 request, and your IP is temporarily blocked by Server. ( That's my guess, because I've read some article online)
Each server has dynamic monitored and each server contains few tenants. For example we have 3 tenants in current Server, and 2 tenants don't have that much request atm, and you will have higher trigger point to retrieve 429 error than the normal time. However, if other 2 tenants are calling REST APIs, the server will dynamic distribute resources to other tenants. If currently you are still having a lot APIs request, the server will block your request for a while than unblock it later when it doesn't have too much pressure.
I forgot original url the article I read, but hopefully you can understand my example from my understanding in the article.
I think you should optimize your code to avoid getting throttled or blocked in SharePoint Online. Or you can contact MSFT to add your tenant in white board to get more API calling usage.
Good afternoon!, is there any update on this? We are getting more 401 errors now, and the only way to past through them is to wait a while and retry
This issue is being closed as part of an issue list cleanup project. Issues with no activity in the past 6 months that aren't tracked by engineering as bugs were closed as part of this inititive. If this is still an issue, please follow the steps outlined to re-open or submit a new issue.
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues