hummingbird-me / kitsu-tools

:hammer: The tools we use to build Kitsu, the coolest platform for anime and manga
https://kitsu.io
Apache License 2.0
2.09k stars 265 forks source link

406 error #792

Closed PedBerTor closed 7 years ago

PedBerTor commented 7 years ago

Hi, my name is Pedro and im making a hybrid application for a university project. Im trying to include kitsu but i have a problem. Following the api documentation i have to include these headers in every request:

"Accept": "application/vnd.api+json" "Content-Type": "application/vnd.api+json"

I have a Java class called KitsuResource that allow me obtain all animes filter by a "slug" (query). This one: captura

The problem comes when i search for an anime because i always obtain the same request error:

org.restlet.resource.ResourceException: OK (406) - The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request

Hope you can help, this is very important for me and i cant find the solution. Thanks.

matthewdias commented 7 years ago

assuming you're using Restlet, looks like you need to cr.getHeaders() instead of cr.getRequestAttributes(). http://stackoverflow.com/questions/9825790/add-headers-to-request-wrapped-by-clientresource-in-restlet