I am attempting to update my SharePoint Events calendar using an HTTP Request step and so far I keep getting hung up on an 415 error. I see that my data is coming through in the tests, but it gets lost when it should post.
The inputs are as follow:
Test Input
{
"host": {
"connectionReferenceName": "shared_sharepointonline",
"operationId": "HttpRequest"
},
"parameters": {
"dataset": "https://thesandlot.sharepoint.com/sites/Ian_DevSandBox",
"parameters/method": "POST",
"parameters/uri": "/_api/web/lists/getByTitle('Events')/items",
"parameters/headers": {
"Accept": "application/json;odata=verbose",
"Content-Type": "applications/json;odata=verbose"
},
"parameters/body": "{\n '__metadata': {'type': 'SP.Data.EventsListItem' },\n 'fAllDayEvent': 'true',\n 'EventDate': '2023-05-15', \n 'EndDate': '2023-05-16', \n 'Title': 'Ian - SICK',\n 'Category': 'SICK',\n 'Description': ''\n}"
}
}
and this is the output:
{
"statusCode": 415,
"headers": {
"Pragma": "no-cache",
"Cache-Control": "no-store, no-cache",
"Set-Cookie": "ARRAffinity=2b32c941e87fc70dc161f1125535279f54f62986d944c59b80b03a276f731b44;Path=/;HttpOnly;Secure;Domain=sharepointonline-ncus.azconn-ncus-001.p.azurewebsites.net,ARRAffinitySameSite=2b32c941e87fc70dc161f1125535279f54f62986d944c59b80b03a276f731b44;Path=/;HttpOnly;SameSite=None;Secure;Domain=sharepointonline-ncus.azconn-ncus-001.p.azurewebsites.net",
"x-ms-request-id": "9570b3a0-e09f-3000-8592-0ebd25fa3a41",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "DENY",
"Timing-Allow-Origin": "*",
"x-ms-apihub-cached-response": "true",
"x-ms-apihub-obo": "false",
"Date": "Tue, 16 May 2023 14:00:10 GMT",
"Content-Length": "421",
"Content-Type": "application/json",
"Expires": "-1"
},
"body": {
"status": 415,
"message": "The HTTP header Content-Type is missing or its value is invalid.\r\nclientRequestId: cdce7444-1d6a-4cfd-8574-3b07376030ae\r\nserviceRequestId: 9570b3a0-e09f-3000-8592-0ebd25fa3a41",
"source": "https://thesandlot.sharepoint.com/sites/Ian_DevSandBox/_api/web/lists/getByTitle('Events')/items",
"errors": [
"-1",
"Microsoft.SharePoint.Client.ClientServiceException"
]
}
}
This is the second part of my question, earlier I learned that I was using quotations in my JSON, so forgive me if this may seem redundant - I'm still getting my feet wet with JSON. I see that my data comes in from the list where the user would create the data that I would like to pull the information used to create the event information, but I dont know what header information I would need as I have only seen "Accept" and "Content-Type".
Full Flow
Update Calendar
It looks like you made a small typo in your Content-Type Header value. It should be application, not applications. Please remove the trailing s and try again.
{
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose"
}