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

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,736 questions
0 comments No comments
{count} votes

3 additional answers

Sort by: Most helpful
  1. MichaelHan-MSFT 18,016 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

    1 person found this answer helpful.

  2. sadomovalex 3,626 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.


  3. MichaelHan-MSFT 18,016 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.