I am using Drupal 8.2.0-rc2. I have HAL, HTTP Basic Authentication, REST UI, RESTful Web Services and Serialization enabled.
In REST UI I have configured:
Content enabled
* GET
* hal_json selected
* json selected
* xml NOT selected
* basic_auth selected
* cookie selected
All other resources are disabled.
Node 68 is of self created content type "Question".
http://my_domain/node/68?_format=json gives {"message":"Not acceptable format: json"}. Why?
I was 1) logged in as admin and 2) not logged in. Same results.
1) ADMINISTRATOR has all permissions automatically
2) ANONYMOUS USER has the following permissions checked
* View all revisions
* View published content
* Form_vraag: View revisions
Anyone any idea what's the problem?
Comments
hal_json works - although not selected
It appears that although I selected "json", in RestResourceConfigInterface (core\modules\rest\config\optional) only hal_json was selected. Is this configuration file used?
http://my_domain/node/68?_format=hal_json works for the anonymous user, no matter how I configure in REST UI.
Although I wrote my own
Although I wrote my own update to REST UI to make it work with 8.2.x and 8.3.x-dev back in early August, its not really needed as you can still adjust any config resource manually at any time via Configuration Synchronization menu.
Configuration Synchronization
Configuration Synchronization menu is used to synchronize the development and production environment? I do not use this. Is it wise to install it for changing config resources only?
Is there another way? Is the resource in the database or in a file?
Configuration Synchronization
Configuration Synchronization has a "Single item" mode found under its import and export tabs. Export lets you examine current setting on a single resource and import let's you quickly make a change. Export also lets you export a single resource yaml file from one of the resources it has in the database.
It worked out. Thanks!
slewazimuth, I used http://mydomain/devel/config (part of the devel module) to change the configuration. And it worked out. Thanks!
In http://mydomain/devel/config I edited rest.resource.entity.node. I changed
formats:
- hal_json
to
formats:
- json
- hal_json
I cleared the cache and now http://mydomain/node/68?_format=json returns the correct json. But this only works when I am not logged in in the browser.
Next I changed
authentication:
- basic_auth
to
authentication:
- basic_auth
- cookie
I cleared the cache again and now http://mydomain/node/68?_format=json also works when logged in as administrator.
Note that I "go to" the url in a regular browser (Chrome).