Getting HTTP Error 406 - Not Acceptable. How Do I Fix This? or What Causes HTTP Error 406 and How Can

20 Replies, 1743 Views

Title: Getting HTTP Error 406 - Not Acceptable. How Do I Fix This?

Hey guys,

So I’m trying to access this API, and boom—http error 406 hits me. "Not acceptable"? What does that even mean?

From what I gathered, it’s something about the server not liking the format I’m asking for. Maybe headers are messed up? Or the server’s picky about content types.

Anyone else run into this? How’d you fix it? I tried tweaking the `Accept` header, but no luck yet.

Also, is this a server-side issue or am I just doing it wrong? lol

Thanks in advance!

---

Title: What Causes HTTP Error 406 and How Can I Resolve It?

Ugh, http error 406 is driving me nuts.

I’m sending a request, and the server’s like "nah, not acceptable." Why??

From my digging, it’s usually about the server not supporting the format (JSON, XML, etc.) I’m asking for. But my headers *seem* fine?

Anyone got tips? Should I check the server config or just spam different `Accept` headers until it works?

Help a frustrated dev out!

---

Title: HTTP Error 406 - Why Is My Request Being Rejected?

Ran into http error 406 today. Super confusing.

Server says my request isn’t "acceptable," but I’m pretty sure I’m sending the right stuff. Tried `Accept: application/json`, but still no dice.

Is this a me problem or a server problem? Maybe the server’s missing a handler for the format I want?

If you’ve fixed this before, pls share how! Short on patience rn.

Cheers!
Hey! Had the same issue last week. The http error 406 usually means the server can't send data in the format your client is asking for.

Try double-checking your `Accept` header—maybe it’s set to something the server doesn’t support. Like, if the API only spits out XML but you’re asking for JSON, that’ll trigger it.

Also, tools like Postman or Insomnia can help debug headers easily. Give those a shot!
Ugh, http error 406 is the worst. It’s not just about headers tho—sometimes the server’s misconfigured.

If you’re sure your `Accept` header is correct, maybe the server’s missing a MIME type for the format you want. Check the server logs or docs.

Orrrr… try sending `Accept: */*` just to see if it works (as a last resort lol).
406 errors are annoying af. Quick fix: make sure your `Accept` header matches EXACTLY what the server expects.

Some APIs are super picky—like, they want `application/vnd.api+json` instead of just `application/json`.

Also, curl with `-v` flag can help see the full convo between you and the server. Lifesaver for debugging!
Yo! http error 406 usually means the server’s like "I don’t serve that flavor, bro."

Check if the API docs specify supported formats. If not, you might need to experiment.

Pro tip: Use Chrome DevTools or Firefox’s Network tab to inspect requests/responses. Sometimes the error details are hiding in there.
Had this exact issue yesterday! http error 406 kept popping up until I realized the API was case-sensitive in headers.

Try `Accept: application/JSON` vs `Accept: application/json`—silly, but some servers care.

Also, if you’re using a library like Axios, default headers might be overriding yours. Double-check!
Not to sound like a broken record, but http error 406 is all about negotiation fails.

Server says "I can’t give you what you’re asking for." So either:
- Your `Accept` header is wrong
- Server’s missing the handler for that format

Try hitting the API with `curl -H "Accept: application/json" [URL]` to isolate the issue.
Lol @ "spam different Accept headers"—been there. But http error 406 is usually fixable.

First, verify the API’s supported formats. If it’s your server, check middleware/modules (e.g., Express’s `res.format()`).

Also, tools like httpie (https://httpie.io/) make header testing less painful.
406 = server’s picky eater mode.

Beyond headers, check if you’re accidentally sending weird chars or malformed requests. Some servers freak out over tiny quirks.

If it’s a REST API, maybe try adding `?format=json` to the URL as a backup plan.
OP here—thanks for all the tips! Tried the `Accept: */*` hack and it actually worked?? Wild.

But now I’m curious: why would the server reject `application/json` but accept `*/*`? Feels like a band-aid fix.

Also, big shoutout to whoever suggested httpie. That tool’s golden. Gonna dig into server logs next. Cheers!



Users browsing this thread: 1 Guest(s)