Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CloseIncident Request on Dynamics 365 v8.2 & V9 On-Premise WebAPI Error 415

(0) ShareShare
ReportReport
Posted on by 380

So I am trying to close a case via Web API using the CloseIncident function. I have setup the code below. For some reason, the api is responding with error 415:

"The request contains an entity body but no Content-Type header. The inferred media type 'application/octet-stream' is not supported for this resource."

I have tried also tried the code on a CRM 2016 server with december update and still got the same error. Am I missing something?

Code:

var closeIncidentPayload = JSON.stringify({
"Status": status,
"IncidentResolution": {
"incidentid@odata.bind": "/incidents(" + caseid.replace(/[{}]/g, "") + ")",
"subject": "Put Your Resolve Subject Here",
"timespent": 0,
"description": "Additional Description Here"
}
});

var xhr = new XMLHttpRequest();
xhr.open("POST", "/api/data/v9.0/CloseIncident");
xhr.setRequestHeader("Accept", "application/json; charset=utf-8;");
xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8;");
xhr.setRequestHeader("OData-MaxVersion", "4.0");
xhr.setRequestHeader("OData-Version", "4.0");
xhr.onreadystatechange = function () {
if (this.readyState === 4) {
this.onreadystatechange = null;
switch (status) {
case 200:
case 201:
case 204:
break;
default:
console.error("Failed CloseIncident Request");
break;
}
}
};
xhr.send(closeIncidentPayload);

*This post is locked for comments

  • Verified answer
    Kevin Grech Profile Picture
    Kevin Grech 380 on at
    RE: CloseIncident Request on Dynamics 365 v8.2 & V9 On-Premise WebAPI Error 415

    Update: Apparently Content-Type header data does not like a trailing semi-colon ';'. I'll see if I can get it to work...

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,403 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans