Forums » Developers



"406 Not Acceptable" when calling Stats API

I'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=107.2.242.97%257c66.147.92.46%257c24.224.75.146%257c66.168.160.225&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
Accept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11
Host: api.getclicky.com
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

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?

Thanks!

Jamie

Posted Tue Jul 10 2012 2:44a by thinkz***


I just did some more testing and discovered when I remove this line from the headers...

Accept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml

... 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:18a by thinkz***


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:06p by Your Friendly Clicky Admin


You must be logged in to your account to post!