3

I would like to GET JSON data from drupal 8 custom entity. I am using ubuntu 14.04 and vagrant. For that i have done these steps.

I have taken reference to Create drupal 8 custom entity from this link.

Enable this modules:

  • HAL - Core module
  • HTTP Basic Authentication -Core module
  • RESTful Web Services - Core module
  • Serialization - Core module
  • Restui - Contributed module

RESTui Configuration:

  • redirect to admin/config/services/rest
  • Enable content_entity_example_contact entity
  • GET Settings done for custom entity enter image description here

    Save.

Permissions given for Rest full web services enter image description here

Postman Plugin is integrated in to chrome. below settings is done for postman. enter image description here

Above steps i have done to GET JSON from custom entity but getting error in postman. Any suggestion or starting point will help for me.

Interestingly when i perform similar steps for drupal 8 node entity i am able to GET JSON data.

enter image description here

Thanks

0

Dou you have an access control handler or an admin permission to control view/create/update/delete access to your entities?

You need to have that, in addition to the rest specific permissions. In fact, those will go away in 8.2, only the generic entity access will matter then.

0

I have given all permissions to Content Entity Example:

  1. Add entity content
  2. Administer settings
  3. Delete entity content.
  4. Edit entity content
  5. View entity content

Clear the cache and restart the Postman.

URL: http://localhost:8080/d8_entity/content_entity_example_contact/1?_format=json

Header : none or blank

Send

Surprisingly got JSON.

Thanks Berdir, your suggestion worked for me.

enter image description here

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.