I received a good response at https://casablanca.codeplex.com/discussions/470633. I believe there's more room for discussion. Until then, this will be the standing answer.
eBay API returns JSON when text/plain is specified in header
Question
I'm looking for some perspective. I'm entirely new to API programming. I've found that calling eBay's GeteBayTime
method is correctly returning JSON but with a header of text/plain;charset=utf-8
, not application/json
. Is this an eBay bug, just average API weirdness, acceptable in some way or what? Could it be an error on my part? I'm using C++ Rest SDK for client API access.
The solution, for those who face the same issue, is to change the response header using set_content_type()
:
if (response.status_code() == status_codes::OK)
{
response.headers().set_content_type(L"application/json");
return response.extract_json();
}
The actual request uses:
http://open.api.sandbox.ebay.com/shopping?callname=GeteBayTime&responseencoding=JSON&appid=<my appid>&siteid=0&version=713
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow