Create a draft reply message give an error on providing payload - microsoft-graph-api

I am hitting the Outlook Office 365 API through Postman. I tried to create a draft reply message using this URL:
POST https://outlook.office.com/api/v2.0/me/messages/{message_id}/createreply
The body contained:
body: {
"Comment": "Sounds great! See you tomorrow."
}
but I got the following error:
{
"error": {
"code": "RequestBodyRead",
"message": "The parameter 'Comment' in the request payload is not a valid parameter for the operation 'CreateReply'."
}
}
I have used this call based on the documentation.
This issue also exists for create a draft reply all message and create a draft forward message.

This is because you're placing comment within the body, it should stand on it's own. From this documentation:
POST https://outlook.office.com/api/beta/me/messages/AAMkADA1MTAAAAqldOAAA=/createreply
Content-Type: application/json
{
"Comment": "Fanny, Randi, would you name the group if the project is approved, please?"
}
Note that it is {"comment": "string"} and not body:{"comment": "string"}.

Related

Postman - Unable to send Post Twilio API request

URL: https://api.twilio.com/2010-04-01/Accounts/{{Twilio_ACCOUNT_SID}}/Messages.json
I am trying to send a Post request using Twilio "send SMS API" in Postman. When I run the request I encounter:
{
"code": 21604,
"message": "A 'To' phone number is required.",
"more_info": "https://www.twilio.com/docs/errors/21604",
"status": 400
}
I am using a free trial account. The "To" Number works fine in Twilio and is validated. I have x-www-form-urlencoded selected in the body of the Post Request in Postman.
It complains about To missing not it being not validated, check your request configuration in Postman.
The Authorisation section should look like this:
And the Body section like this:
Make sure that you call your key To (that is uppercase T and lowercase o) and that you provide a E.164 formatted number.

Create Team, 400 Bad Request, Required functionality is not supported

I'm trying to create a Microsoft Teams team in Migration mode via the Graph API. However I get a 400 response that I can't figure out. The query is shared in the link below.
Shared Query
For those that don't want to view it that way, here is my request:
POST https://graph.microsoft.com/beta/teams
Authorization: Bearer ...
Content-Type: application/json
{
"#microsoft.graph.teamCreationMode": "migration",
"template#odata.bind": "https://graph.microsoft.com/beta/teamsTemplates(\u0027standard\u0027)",
"displayName": "SlackMigrationTest",
"description": "testing slack migrations",
"createdDateTime": "2021-01-14T00:00:00.000Z"
}
I created this based on the microsoft doc here.
The reponse I get is:
The remote server returned an error: (400) Bad Request.
{
"error": {
"code": "BadRequest",
"message": "Required functionality is not supported.",
"innerError": {
"date": "2021-01-20T15:51:21",
"request-id": "dc4189cf-db4a-4a60-a271-f63b5d759a05",
"client-request-id": "dc4189cf-db4a-4a60-a271-f63b5d759a05"
}
}
}
I'm sure its something obvious that I'm missing but any help would be greatly appreciated.
Here you are using the User Context token and trying to make the call. This API call only works in Application context as shown in the below screenshot.
So use Client Credential flow and set Application permissions and then make a call.
As you can see below, it worked for me with App token.
You cannot test it in graph explorer because the Graph Explorer gets user token.

A post call to add a new openTypeExtension to event data fails with “Resource not found for the segment 'extensions'”

I am trying to add an extension to the event resource using Graph Explorer. I am using POST on https://graph.microsoft.com/v1.0/event/extensions with request body
{
"#odata.type": "microsoft.graph.openTypeExtension",
"extensionName": "com.wrike.WrikeIDs",
"id": "",
"permalink": ""
}
I get the error
"Resource not found for the segment 'event'"
and sometimes I get
"The OData request is not supported"
Content type is application/json
The error message might be misleading.
Try to adjust the path to
POST https://graph.microsoft.com/v1.0/me/events/{event_id}/extensions

UnknownError when creating a MicrosoftGraph subscription

I am working on a project to set up a webhook with Microsft graph. I have everything set up to validate the endpoint I have created as per (https://developer.microsoft.com/en-us/graph/docs/concepts/webhooks), however, I am receiving an "Unknown Error" from Microsoft as follows:
"__SLOG0__", "{
\"error\": {
\"code\": \"UnknownError\",
\"message\": \"\",
\"innerError\": {
\"request-id\": \"d0037849-dc79-4244-bb15-cf72841c6653\",
\"date\": \"2018-10-22T20:00:43\"
}
}
}"
I create the subscription with the following values:
$body_vals = dict[
"changeType" => "created,updated",
"notificationUrl" => $notification_uri,
"resource" => "/me/mailfolders('inbox')/messages",
"expirationDateTime" =>
Office365APIUtils::getISO8601DateStamp($date->getTimestamp()),
"clientState" => "SecretClientState",
]
passed into my POST request to the endpoint. I know this has to do with my specific notification uri (which is a facebook endpoint) because if i switch the endpoint to https://google.com, for example, I get a more helpful response:
"__SLOG0__", "{
\"error\": {
\"code\": \"InvalidRequest\",
\"message\": \"Subscription validation request failed. Must respond with 200 OK to this request.\",
\"innerError\": {
\"request-id\": \"4e2ac4af-4d10-416d-83a1-4eb896a35418\",
\"date\": \"2018-10-22T19:52:46\"
}
}
}"
saying I have to validate at the endpoint. I already registered my app, if there is anyone with the Graph team or that has dealt with this before with any leads on these UnknownErrors? an example request-id is 7da743ce-6ffe-4d80-8611-a5be024c8b21
It looks like your code may not be performing the endpoint validation step. This article contains a complete walk-through of how to create a subscription. Have a look at the "Notification endpoint validation" section; your endpoint must be able to respond with 200 and include the validation token.

Twilio Outbound POST: Content-Type on Text

My goal is to take a text message sent to Twilio #, POST that information to my platform (ServiceNow). I believe my issue is that ServiceNow Script API can only receive content-type = [application/json, application/xml, text/xml] and so I get an error response invalid content type.
Looking at Twilio debugger, I don't see any explicit parameter called content-type. Any insights on what I might do here?
Response:
{
"error": {
"message": "Invalid content-type. Supported request media types for this service are: [application/json, application/xml, text/xml]",
"detail": null
},
"status": "failure"
}
Twilio developer evangelist here.
When Twilio sends a webhook for an incoming message the request is formatted as application/x-www-form-urlencoded.
If you are unable to find a way for ServiceNow to accept application/x-www-form-urlencoded you could try using a Twilio Function to translate the data to JSON and send it on to your endpoint.
Let me know if that helps at all.

Resources