Share via

Sharepoint API Error ID3035

Gabriele Iodice 101 Reputation points
2021-05-04T09:21:19.323+00:00

Hello,

I am trying to download a file using the Sharepoint API.
I get the Access Token then I use the following API to read a folder (or any other API to download a file), but I always have the following error

GET https://{site_url}/_api/web/GetFolderByServerRelativeUrl('/Shared Documents')
Auth: Bearer {toke}

as explained here https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest

{"error_description":"ID3035: The request was not valid or is malformed."}

The authentication token must be correct because when I change it I have a different error.

Thanks!
Gabri

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments

Answer accepted by question author

Gabriele Iodice 101 Reputation points
2021-05-07T09:21:11.253+00:00

Hi @MichaelHan-MSFT ,
thanks for your help.

You were right: the authentication was the problem. But the documents you shared were not exactly what I was looking for. This is the thing that helped me a lot:

https://www.ktskumar.com/2017/01/access-sharepoint-online-using-postman/

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

3 additional answers

Sort by: Most helpful
  1. MichaelHan-MSFT 18,136 Reputation points
    2021-05-06T09:06:38.07+00:00

    Hi @Gabriele Iodice ,

    I'm not an expert with java. From your code, you are acquiring AAD token using app client ID and secret. This way is to authenticate with Graph API. And It would not work for SharePoint Rest API.

    For SharePint Rest API with AAD app, you need to get the token with the certificate opion. You can refer to this article for more: https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azuread

    Was this answer helpful?

    1 person found this answer helpful.

  2. MichaelHan-MSFT 18,136 Reputation points
    2021-05-05T02:32:30.517+00:00

    Hi @Gabriele Iodice ,

    How did you retrieve the Access Token? Please share more details. Use SharePoint APP or AAD APP?


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


  3. sadomovalex 3,636 Reputation points
    2021-05-04T13:18:47.31+00:00

    few questions: do you work with SPO on onprem? And how exactly you get the token? Here is example of how to get access token for SPO: SharePoint Rest API how to get Access Token.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.