The HTTP header Content-Type is missing or its value is invalid error in REST API in SharePoint 2013/2016/Online

The HTTP header Content Type is missing or its value is invalid
SharePoint deveopment training course

This SharePoint Rest API tutorial explains, how to solve “The HTTP header Content-Type is missing or its value is invalid” error which comes in Rest API in SharePoint 2013.

Recently I am trying to retrieve some information using SharePoint 2013 REST API. I wrote the code like below:

headers: {
"accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
}

But it gave me error like:
Microsoft.SharePoint.Cient.ClientServiceException. The HTTP header Content Type is missing or its value is invalid. Unsupported Media Type. The error looks like below:

The HTTP header Content Type is missing or its value is invalid
The HTTP header Content Type is missing or its value is invalid

The HTTP header Content Type is missing or its value is invalid

The error was coming because content-type was missing and it got resolved by adding the below line:

"content-type": "application/json;odata=verbose"

The full code looks like below:

headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
}

You may like following SharePoint rest API tutorials:

Hope this SharePoint tutorial helps to resolve, The HTTP header Content-Type is missing or its value is invalid error in REST API in SharePoint 2013/2016/Online

Check out Best Alternative to InfoPath -> Try Now

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →