2

I have rest service url for a node in d6 as

https://192.168.1.236/rest_endpoint/node/1140.json 

but the same url in drupal 8 is not working at all , for d8 i have to give

https://192.168.1.236/rest_endpoint/node/1140?_format=json

here 1140 is the node id and 192.168.1.236 is the base url .

As the url is changing i have to modify many scripts .What may be the reason for this ? or is there any workarounds ?

2

From the related issue:

Drupal core no longer uses accept headers for routing but rather rely on a _format query parameter, because browser, (reverse) proxy and CDN support is very poor, and hence could lead to severe bugs. See See #2364011: [meta] External caches mix up response formats on URLs where content negotiation is in use for more background.

So it was a conscious decision, to help prevent common bugs out in the wild. I wouldn't advise trying to find a workaround, the motivation for changing it is sound. But if you want/need to, perhaps just a simple rewrite rule that would take requests for *.json and forward them on to *?_format=json would suffice.

| improve this answer | |
  • thanks , probably redirection without changing the url with htaccess would work ? – KTM May 25 '16 at 8:37
  • Can't think of a reason it wouldn't, it'd definitely save you a lot of work – Clive May 25 '16 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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