onedrive-api-docs: 429 - throttledRequest errors using /createLink endpoint after creating just a few links

Category

  • Question
  • Documentation issue
  • Bug

Observed Behavior

Since a while, I am getting 429 - throttledRequest errors when creating a few read-only shared links via the /drives/{driveId}/items/{itemId}/createLink endpoint. It seems to be specific for OneDrive Personal accounts.

{
    "type": "view",
    "scope": "anonymous"
}

Here is the specific response I get

{

  "headers": {
            "retry-after": "3360",
  },
  
  "error": {
            "code": "accessDenied",
            "message": "Too Many Requests",
            "innerError": {
                "code": "throttledRequest",
                "date": "2021-02-11T09:36:01",
                "request-id": "a28f6f2b-b233-47a1-85dd-111da0293500",
                "client-request-id": "a28f6f2b-b233-47a1-85dd-111da0293500"
            }
        }
}

Generally speaking that shouldn’t be an issue, however:

  • I get this error if I create only 10 links in ~5 minutes time. Even if no API calls were made that day at all /for this user.
  • The error is also thrown if a sharing link already exists for the file.
  • The Retry-After period is set to ~ 1 hour, which makes it practically impossible to use the backoff mechanism that is implemented to prevent throttling.

Also:

  • I haven’t observed this issue until a few weeks ago
  • I can only reproduce this for OneDrive Personal accounts.
  • All other other endpoints are not throttled. So other API requests are successful when the /createLink request is still being throttled.

Steps to Reproduce

Create multiple (>10) shared read-only links via the API on a OneDrive Personal account.

Question

Is this behavior expected and has the throttling threshold indeed been decreased? Or is this a bug in the API itself which has been introduced?

If the limit is indeed this low, it would be a good idea to mention this in the documentation as it limits the use of this specific endpoint.

[ ]: http://aka.ms/onedrive-api-issues [x]: http://aka.ms/onedrive-api-issues

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (2 by maintainers)

Most upvoted comments

We ran into the same issues here. Here is our scenario:

Use Case

We are building an edtech tool for teachers to assign their assignments from OneDrive to students. Each student will get their own copies so that they can do the assignments individually. The copies will be created in teacher’s OneDrive so we use create link to give students permission to edit their own copies.

Given the number of students and the number of assignments that a teacher might have to share, 50 calls/ hour is not possible for the workflow.

Questions

  1. Is it possible to raise the limit given API key? What would be the process here?
  2. Is it possible that we create the copies that can be shared by default so that we don’t need to call create share link? I didn’t see this option in the documentation though.

@gcarden It would be great that you can provide some help here. Thanks

Use Case:

I am using the application in a form where users can attach their documents or images. The files will be stored in a user specific folder on OneDrive when the form is submitted. Shared links to the files are created to be included in an email notification to multiple recipients and stored in a database.

  • It is possible that a user attaches >50 files at once in a weekly basis via this form. Or that 5 users each upload 10 files in the same hour coincidentally. No heavy usage of the API but it is just possible that more than 50 shared links have to be created in a hour.
  • The email notification cannot be delayed (at least not for more than a couple of minutes)

Questions:

  1. If the the API endpoint /createLink is limited to 50 calls/hour, why is the API throttling the requests directly after just ~10-20 calls are being made (see the trace I created)? The throttling directly returns a retry header of 1 hour while the limit you describe isn’t hit. That seems to be the main problem here.

  2. Why is the /createLink endpoint just limited to 50 calls/hour? I haven’t seen such limits on other similar APIs. In most cases the usage (e.g. bandwidth) of the shared links is limited, but not the link creation itself.

  3. Can you please document this API limit on the /createLink page?

Thanks for your feedback. This is currently being investigated internally.