How could I send an JSON message in content of request body using Graph API?

林彥良 21 Reputation points
2021-06-24T08:43:15.823+00:00

I'm using microsoft graph api to send messages to Microsoft Teams, and I noticed that in the request body all message content in "content" could only send single text.

I would like to send an JSON format message in the "content" block, so I set "contentType" as "application/json" in the request body, and the content look like this:

"content":{"value1":0.1, "value2":0.5}

However, it returns "Invalid request body content"

I could success by setting contentType as html, but how could I send JSON content?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,686 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,612 questions
0 comments No comments
{count} votes