HTTP Response Status 406: Not Acceptable

I was recently writing a mobile application using Apache Cordova along with Ionic framework. I kept getting a status 406 response when I was trying to post some data to the API. Since the API was not written by me and I had no access to it either I ended up wasting a good hour on it, since every person with a 406 error seems to have had a different solution each time.

So after awhile I finally asked someone with access to the server logs to check the requests made with my data key and send them to me.

I cannot post that here since it’s a private api, however long strory short, the problem was witht the content type header.

Instead of application/json, I had used application/JSON.

I know, I know, simple mistake, but it’s often the simplest of things that get overlooked, specially since 406 is so cryptic….

TL;DR If you keep getting a cryptic 406 error with a Not Acceptable header, check you content type characters and case. 



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s