Sharepoint API Error ID3035

Gabriele Iodice 101 Reputation points


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

{"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.


A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
6,058 questions
No comments
{count} votes

3 additional answers

Sort by: Most helpful
  1. Michael 17,861 Reputation points

    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:

  2. sadomovalex 3,591 Reputation points

    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. Michael 17,861 Reputation points

    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.