function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
nitesh gadkarinitesh gadkari 

How to pass content type value in REST API URL

Hi Everyone,

I have a query related to REST API url. 

I have exposed a REST API via Force.com sites, which will create record once the API is hit. I want to pass all parameters in URL. But, doing this i encounter following error:

[{"errorCode":"UNSUPPORTED_MEDIA_TYPE","message":"Content-Type header specified in HTTP request is not supported: application/x-www-form-urlencoded"}]

To resolve this how can i pass the required content type value in url or what's the alternate way to resolve this.


Regards
Nitesh

 
sandeep sankhlasandeep sankhla
Hi Nitesh,

Can you share your code here? and also try using 
headers: { 'Content-Type': 'application/json' }