Asked by:
400 Bad Request Returned

Question
-
in azure search i copied the demo from the codeplex, change my service api keys..
Indexing is also creating ,but while uploading the document it shows me this error
400 Bad Request
Returned when there is a syntax error in the request URI, headers, or body.
Content: System.Net.Http.StringContent,
Headers:
{
Content-Type: application/json; charset=utf-8
}}please help its urgent for me...
Wednesday, January 28, 2015 11:22 AM
All replies
-
Could you post the exact request body you're sending to the server or the code that's creating that request body? If you'd rather not post it here feel free to send it via email to Pablo DOT Castro AT usual domain.
This posting is provided "AS IS" with no warranties, and confers no rights.
Wednesday, January 28, 2015 5:22 PM -
Also, if you could post the response body you get back with the 400 status code, that would also help.Wednesday, January 28, 2015 10:02 PM
-
I also get 400 Bad Request sometimes, which implies I have some syntax or semantic error in my request.
It usually takes me some time to track down what the error is. Is there some way to get a more detailed error description? Is it in the "response body"? How do I get that?
I have this code:
response.EnsureSuccessStatusCode();
It returns something called ReasonPhrase, but it doesn't give any help
Vilhelm Heiberg, ExorLive AS
Friday, February 6, 2015 11:53 AM -
Hi Vilhelm,
Assuming that "response" is an HttpResponseMessage, you can do this to get the response body:
string content = await response.Content.ReadAsStringAsync();
- Proposed as answer by Bruce Johnston - MSFT Friday, February 6, 2015 5:21 PM
Friday, February 6, 2015 5:21 PM