I'm using the beta Microsoft Graph API, to create tasks in the Planner.
As part of the create task we use the task details to update the task with links, using the externalReferenceCollection see http://graph.microsoft.io/en-us/docs/api-reference/beta/resources/externalreferencecollection
and http://graph.microsoft.io/en-us/docs/api-reference/beta/api/taskdetails_update, the documentation specifically states that:
"In this case, the client must provide valid URLs based on the HTTP/HTTPS protocols as properties and their values must be the externalReference objects. Based on OData, property names in Open Types cannot contain the following characters: ., :, % so they need to be encoded. " I do encode the specified values but the # within the URL causes an error.
An example using REST URI to update the task details is:
https://graph.microsoft.com/beta/tasks/S1VywG4fe0q2qCoMRmjYYpYAJh9q/details
and the content body JSON is:
{"description": "My Task Title description 1", "previewType": "description" , "references": {
"https%3A//dashboard-me%2Ec9users%2Eio/#/edit/342f13159eaf1a":
{
"@odata.type": "#microsoft.graph.externalReference",
"alias": "Edit link",
"type": "Other"
} }}
As can be seen above the the item "https%3A//dashboard-me%2Ec9users%2Eio/#/edit/342f13159eaf1a" contains a # in the URL, removing the # allows the update to work, when the # is there the update fails with a BadRequest (400) and the following:
{
"error": {
"code": "",
"message": "The request is invalid.",
"innerError": {
"request-id": "65d98658-16a2-4525-850e-6a0aee382c97",
"date": "2016-07-23T10:44:44"
}
}
}
I've raised this with Microsoft and was advised by them to also post here.
Many thanks
Terry