Share via

Getting unknown error while requesting "https://graph.microsoft.com/beta/me/chats" in postman

Bipin P 61 Reputation points
2020-09-17T15:03:10.177+00:00

Getting unknown error while requesting "https://graph.microsoft.com/beta/me/chats" in postman.
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"date": "2020-09-17T14:52:19",
"request-id": "de5b5553-6a96-4433-8655-48da1dbe77fd",
"client-request-id": "de5b5553-6a96-4433-8655-48da1dbe77fd"
}
}
}
But I am getting a positive response when I tried for other requests like "https://graph.microsoft.com/beta/me/".

I have generated a token with the following ways in postman snapshot.
25642-getting-token.jpg

For more troubleshooting, I have cross verify with Graph Explorer and I am getting a positive response over there. Did I miss anything in the postman to get 1:1 Chat details?

Microsoft Teams | Development
Microsoft Teams | Development

Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs

Microsoft Security | Microsoft Entra | Microsoft Entra ID

Answer accepted by question author

JamesTran-MSFT 37,256 Reputation points Microsoft Employee Moderator
2020-09-17T23:50:28.37+00:00

@Bipin P
I tried reproducing your issue, however, I received a "forbidden" error instead of "unknown".

Can you try getting the chatID, then using the get chat call rather than using the "/me/chats"? I'd also make sure that your app registration has delegated permissions of either Chat.ReadBasic, Chat.Read, or Chat.ReadWrite

List Chats
GET https://graph.microsoft.com/beta/users/{id}/chats

Get Chat
GET https://graph.microsoft.com/beta/users/{id}/chats/{id}

Additional Link:
Chat resource type

25589-forbiddenerror.jpg

Please let me know if you have any other questions.
Thank you for your time.

Was this answer helpful?


3 additional answers

Sort by: Most helpful
  1. Bipin P 61 Reputation points
    2020-09-21T05:28:56.45+00:00

    Thanks for replying @JamesTran-MSFT ,
    I have asked my Administrator Team to grant or consent Chat.ReadBasic permission. Another permission like Chat.Read and Chat.ReadWrite has already consented. Once Chat.ReadBasic permission approved I will come to you for further discussion.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  2. JamesTran-MSFT 37,256 Reputation points Microsoft Employee Moderator
    2020-09-21T22:09:59.597+00:00

    @Bipin P
    Thanks for the follow up! I'm glad that after you received the 'Chat.ReadBasic' permission it worked. For your follow up questions, please see below for my findings.

    Findings:
    /me/chats/<ChatID>/messages?$top=1
    -Get chatMessage endpoint, doesn't support OData query parameters such as top.

    /me/joinedTeams?$expand=channel
    -List joinedTeams endpoint, doesn't support OData query parameters such as expand

    /teams/<TeamId>/channels/<ChannelId>/messages?$expand=replies
    -Get channel message, doesn't support OData query parameters such as expand

    When it comes to the error message you received, it looks like this is a feature that might need to be raised via a feature request.
    "Query option 'Expand' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings."

    If you have any other questions, please let me know.
    Thank you again for your time and patience throughout this issue.

    Additional Links:
    MS Graph Teams known isssues

    Was this answer helpful?


  3. Bipin P 61 Reputation points
    2020-09-21T14:56:25.997+00:00

    Thanks, @JamesTran-MSFT ,

    After given Chat.ReadBasic permission It works. Then I was doing a couple of queries

    1. https://graph.microsoft.com/beta/me/chats/\<ChatID>/messages?$top=1 - Not working
      All messages are showing in the result box without applying top query
    2. https://graph.microsoft.com/beta/me/joinedTeams?$expand=channel - Not Working {
      "error": {
      "code": "BadRequest",
      "message": "Bad Request",
      "innerError": {
      "date": "2020-09-21T14:36:20",
      "request-id": "a273ba5a-9131-4dc8-9be3-xxxxxxxxxxxx",
      "client-request-id": "a273ba5a-9131-4dc8-9be3-xxxxxxxxxxxxxxx"
      }
      }
      }

    3) https://graph.microsoft.com/beta/teams/\<TeamId>/channels/<ChannelId>/messages?$expand=replies Not Working

    {  
        "error": {  
            "code": "",  
            "message": "The query specified in the URI is not valid. Query option 'Expand' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings.",  
            "innerError": {  
                "message": "Query option 'Expand' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings.",  
                "date": "2020-09-21T14:43:04",  
                "request-id": "241508c8-020f-4cb1-9b8d-XXXXXXXXXXXXX",  
                "client-request-id": "241508c8-020f-4cb1-9b8d-XXXXXc5bcefbdde"  
            }  
        }  
    }  
    

    I have taken reference from query-parameters link and I believe it should work on postman and graph explorer. I have also verified that https://graph.microsoft.com/beta/$metadata#chats provides NavigationProperty https://learn.microsoft.com/en-us/graph/query-parameters#expand-parameter

    Kindly help me to sort out the above queries.

    Was this answer helpful?

    0 comments No comments

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.