How can i use Microsoft Graph API to access .json files on onedrive with character '#' in the path?

Copper Contributor

I try to use the following code to access the file on OneDrive, but it doesn’t work.

 

$ curl 'https://graph.microsoft.com/v1.0/me/drive/root:/share/test/%23.json' -H 'Authorization: ************' | python3 -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   295    0   295    0     0    458      0 --:--:-- --:--:-- --:--:--   458
{
    "error": {
        "code": "activityLimitReached",
        "message": "The request has been throttled",
        "innerError": {
            "code": "throttledRequest",
            "innerError": {
                "code": "quota"
            },
            "date": "2022-02-11T13:02:47",
            "request-id": "b4767316-6713-4cee-9b67-23a781a6c6fc",
            "client-request-id": "b4767316-6713-4cee-9b67-23a781a6c6fc"
        }
    }
}

Ps: Well, I ran this code 2 days ago, but the problem still occurs. 

 

The things I know:

  1. I found that it only seems to happen on .json files with ‘#’ in the path (so I think it’s not because of escaping of character ’#’).
  2. I’m sure the file syncs correctly on OneDrive and I can access the file with OneDrive client.

Ps: English is not my mother language, so l’m sorry if there’re some grammar mistakes make you confused.

1 Reply

Hi @earthmessenger,

 

I've just come across a similar problem where I'm unable to download an invalid JSON file using the graph API on NodeJS.

 

I believe the reason for both our issues is that the API is parsing the JSON file into a Javascript object and that causes an error if the parse fails.

 

Comments (i.e hashes #) in JSON files are invalid, so that would explain your issue too.

 

It would be useful to have a raw option or something like that to enabled downloading JSON files as text.

 

Unfortunately I can't give a solution, but hopefully knowing the likely reason will help.

 

Cheers - Lawrence