Getting 400 Bad Request for search graph api

Omkar 6 Reputation points
2021-10-18T14:47:58.77+00:00

Hi, Im getting 400 Bad Request for search graph api on angular using MSAL lib.

  • I have added permission scope correctly on portal and code both.
  • Getting 200 response for read profile api (v1.0/me)
  • The problem seems to be in token. I believe I have followed documentation correctly to setup app and grant api permission on azure portal. Also tried comparing the token with token generated on graph explorer for the scopes etc. seems identical.

API - https://graph.microsoft.com/v1.0/search/query

 {
        "error": {
            "code": "BadRequest",
            "message": "\r\n The call failed, please try again.",
            "innerError": {
                "date": "2021-10-18T14:18:41",
                "request-id": "07227194-d032-4086-9196-58c33a3027f3",
                "client-request-id": "07227194-d032-4086-9196-58c33a3027f3"
            }
        }
    }
Microsoft Security Microsoft Entra Microsoft Entra ID
Microsoft Security Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. James Hamil 27,211 Reputation points Microsoft Employee Moderator
    2021-10-19T18:18:45.31+00:00

    Hi @Omkar I assume you've seen this thread, but if not it provides a good range of solutions for your issue: https://stackoverflow.com/questions/43332236/bad-request-400-when-making-api-call-to-microsoft-graph

    Without any more information this is tricky to solve. Can you please email your query to jahami@microsoft.com? I can look it over and see if I can spot the issue.

    Best,
    James


Your answer

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