"406 Not Acceptable" when calling Stats APII'm calling the Stats API using the RestSharp library for C#. The URL I'm calling is
http://api.getclicky.com/api/stats/4?site_id=66559673&sitekey=[my site key redacted]&type=visitors-list&date=2012-05-31&limit=all&ip_address=22.214.171.124%257c126.96.36.199%257c188.8.131.52%257c184.108.40.206&visitor-details=ip_address%252csession_id
The response I'm getting is a "406 Not Acceptable". The body says "An appropriate representation of the requested resource /api/stats/4 could not be found on this server."
If I copy and paste this exact URL (with my site key, of course) into Chrome, it works just fine.
I've even gone into the code and replicated the exact request that the RestSharp library creates in Fiddler, which looks like this...
GET [same url, redacted to bypass spam filter] HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11
Accept-Encoding: gzip, deflate
And this works too.
I can't see what I'm doing from my side that would be causing this error. Do you have anything in your logs indicating why this might be happening?
Posted Tue Jul 10 2012 2:44am by thinkzig
I just did some more testing and discovered when I remove this line from the headers...
... that everything works fine.
I'll modify my code to remove this header, but that's a fairly standard header and it seems like it should work.
Posted Tue Jul 10 2012 6:18am by thinkzig
That is strange, it should be outputting XML by defautl since you're specifying the output type. Apache just must not like that header for some reason.
Posted Thu Jul 12 2012 3:06pm by Your Friendly Clicky Admin