0

I have an issue with creating a node via the API. I have the correct permissions setup but it seems like a glitch somewhere in the permissions. An admin can create a content but no other role can. [content type]: Can create new content permission is checked.

Error; access denied - /node?_format=hal_json

Config:

enter image description here

Client:

return api({
    method: 'post',
    url: 'node?_format=hal_json',
    data: JSON.stringify(_node),
    headers: {
        'Content-Type': 'application/hal+json',
        'X-CSRF-Token': _xscrf_token,
    },
});
0

Make sure you check the correct permissions for the roles you want in the "RESTful Web Services" section on the /admin/people/permissions page.

| improve this answer | |
  • The permissions are right. There is an issue with Drupal. If the role is given "Administer content" permission, the issue resolves. But that shouldn't be the case. – Abdul Sadik Yalcin Feb 14 at 10:48
0

Url should be /entity/node?_format=hal_json

| improve this answer | |
  • What difference does this make in terms of user roles? 'An admin can create a content but no other role can' - that's my issue. – Abdul Sadik Yalcin Jun 2 at 16:37
0

Refer this link it will help you https://www.agiledrop.com/blog/how-create-node-drupal-8-using-rest

| improve this answer | |

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.