A client error happened - Drupal 8 REST API Post method
Asked Answered
T

2

5

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.

enter image description here

Thordia answered 11/5, 2020 at 7:15 Comment(2)
if i call service with get method working fine.Thordia
Check the Drupal logs for any errors. Debug with Postman and post more information.Padlock
A
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.

Ascribe answered 27/10, 2020 at 13:27 Comment(1)
This worked perfect. It also works nice for xml format too with ?_format=xmlCongest
P
12

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!

Piave answered 13/3, 2021 at 19:26 Comment(1)
This should be the accepted responsePaestum
A
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.

Ascribe answered 27/10, 2020 at 13:27 Comment(1)
This worked perfect. It also works nice for xml format too with ?_format=xmlCongest

© 2022 - 2024 — McMap. All rights reserved.