Hi All,
I am using rest api to add features using c# HttpClient. My data is added successfully but i am getting response in html instead of JSON.
here is my sample code:
var client = new HttpClient();
client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/x-www-form-urlencoded");
client.DefaultRequestHeaders.TryAddWithoutValidation("Accept", "application/x-www-form-urlencoded");var inputJson = JsonConvert.SerializeObject(featureOobj);
var parameters = new Dictionary<string, string> { { "features", inputJson } };
var encodedContent = new FormUrlEncodedContent(parameters);HttpResponseMessage response = await client.PostAsync(url, encodedContent)
How to receive rest api response in JSON?
Any help would be appreciated.
Regards,
Prashant
Solved! Go to Solution.
To set the output format, use the "f" query parameter:
f=json
See Output formats for more information.
To set the output format, use the "f" query parameter:
f=json
See Output formats for more information.
Thanks for the help Randy,