While i call Drupal 8 custom rest API post method, i am getting below error. please help to me resolve this i struggle last 4 days.
Asked
Active
Viewed 2,511 times
4
-
if i call service with get method working fine. – Ambal Mani May 11 '20 at 07:17
-
Check the Drupal logs for any errors. Debug with Postman and post more information. – Albert Skibinski May 14 '20 at 14:12
2 Answers
8
You are missing a configuration on your view, please do the following:
Edit the view you are exposing your REST export > In the format section click on the Settings link > In the Accept Request formats check the JSON option > Click on the apply button > Save the changes to your view.
Now you should have the JSON response without adding the query "?_format=json".
Cheers!

Uesli Almeida
- 81
- 1
- 1
4
I also get the client error. I simply used the same path and added ?_format=json
at the end of the URL and it's working.

Adrian Mole
- 49,934
- 160
- 51
- 83

Suripa Saha
- 64
- 1
- 2
-
This worked perfect. It also works nice for xml format too with ?_format=xml – C13L0 Apr 06 '22 at 13:56