1

I can't get the Taxonomy terms to work with the Rest API. I've used the Rest UI module to enable the Taxonomy Term for the Rest API, and enabled all formats.

When I request http://www.domain.com/taxonomy/term/1?_format=json though, I get the message:

{"message":"Not acceptable format: json"}

Same for for hal and xml. Everything works fine for nodes, so I suspect a bug somewhere. Using 8.2.6 .

3 Answers 3

1

This works as expected using Drupal 8.3.x using latest Rest UI Mar 28, 2017.

Note I have tested as admin and anonymous with same results. Enabling HAL and requesting the formats xml and hal_json gave the expected results too.

Disabling cookie request and enable basic_auth give a different response.

{"message":"The used authentication method is not allowed on this route."}

Hope this helps.

1

Im having this issue but with nodes, not with Taxonomy terms. Im trying to get the json of a node by doing http://localhost/mysite/node/1?_format=json

However all i get is {"message":"Not acceptable format: json"} Event thou i configured the REST resources like this:

enter image description here

When i try with taxonomy term it works, just like described on Clemens Comment. However nodes still give me the Not acceptable format issue. Is there any configuration im missing to make the nodes endpoints work?

1

This could be the url pattern /taxonomy/term/%, which is same in views and Rest api.

When you check the request object, it has the controller ViewPageController::handle, where as in deleting nodes, the request goes through RequestHandler::handle which is from the REST module.

I have checked the views page for taxonomy views and found the a page with the same url pattern /taxonomy/term/%. Just tried disabling this view and hit the API, and checked the request, which now calls the RequestHandler controller.

The issue is with same url pattern provided in Views page and the REST API, As the url pattern is already registered in views, the api call doesn't work.

So try to disable the taxonomy view and hit the api again.

Check this at drupal.org

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.