I tried to get taxonomy vocabulary details with REST /entity/taxonomy_vocabulary/{id} end point
Here id is machine name for taxonomy vocabulary.
my rest.setting
'entity:taxonomy_vocabulary':
GET:
supported_formats:
- hal_json
- json
supported_auth:
- basic_auth
- cookie
I have give enough permission to administrator to access GET on taxonomy_vocabulary resource.
On Drupal 8 alpha 11 I got 500 Internal server error irrespective to Accept header ( i.e json or hal+json )
On Drupal 8 alpha 12 I got 200 ok with a fatal error Fatal error: Call to a member function access() on a non-object in /Applications/XAMPP/xamppfiles/htdocs/dr8a12/core/modules/rest/src/Plugin/rest/resource/EntityResource.php on line 50
irrespective to Accept header ( i.e json or hal+json )
I have attached supporting snap for both.
While discussing this issue with Jeff Linwood (https://www.drupal.org/u/jefflinwood) we conclude that in Drupal 8 alpha 12 it is serialization error because of one or more entity field for vocabulary is not getting serialized properly.
Community review needed.
Comment | File | Size | Author |
---|---|---|---|
Taxonomy_vocabularyDr8alpha12.png | 66.44 KB | vivekvpandya | |
Taxonomy_vocabularyDr8Alpha11.png | 55.64 KB | vivekvpandya |
Comments
Comment #1
vivekvpandya CreditAttribution: vivekvpandya commentedComment #2
klausiTaxonomy vocabularies are configuration entities, right? REST module in its current state only supports content entities, I guess we should document that somewhere.
Why do you need to retrieve taxonomy vocabularies?
Comment #3
larowlanComment #4
vivekvpandya CreditAttribution: vivekvpandya commentedI am working on GSoC 2014 project to create iOS client that manipulates nodes on drupal 8 site. in that while creating or updating content with a 'tag' field i want to give user choice for tags So I want to retrieve tags vocabulary on my iOS app.
More info on my project https://groups.drupal.org/node/407793#project15
Comment #5
larowlanI think you will need to write a custom end-point (resource plugin), see the dblog example in core.
(Drupal\rest\Plugin\rest\resource\DBLogResource)
Comment #6
klausiSo you don't want to retrieve the vocabulary itself, but rather a list of terms in that vocabulary, right? First solution that comes to my mind is building a View with a REST export display that lists terms of that vocabulary.
Comment #7
clemens.tolboomThis is not a bug. The URI is changed as of Change notice https://www.drupal.org/node/2199185
You should use http://drupal.d8/taxonomy_vocabulary/tags
Easiest way is to install https://www.drupal.org/project/restui then enable all resources.
Check your rest tool for response codes. I got several different responses:
Using incorrect path: 404 (not found) | http://drupal.d8/entity/taxonomy_vocabulary/tags
Using correct path: 403 (access denied) | http://drupal.d8/taxonomy_vocabulary/tags
Setting more and more permissions : 500 | http://drupal.d8/taxonomy_vocabulary/tags
I did not managed to get a working Rest export so please tell us your result.
Comment #8
vivekvpandya CreditAttribution: vivekvpandya commentedI have tested it with Drupal 8 alpha 12 and it is not canonical path /entity/taxonomy_vocabulary/{id} is correct path and result for them are displayed in attached screen shots.
Comment #9
vivekvpandya CreditAttribution: vivekvpandya commentedCanonical endpoints are only available for node, user and I think comment entity types as per Drupal 8 alpha 12 experience.
Comment #10
clemens.tolboom@vivekvpandya thanks for the correction.
I checked all methods for all resources using REST UI module with
jQuery('input[type=checkbox]').prop('checked', true);
then ran
select name, path from router where name like 'rest.%';
then checked for the non /entity endpoints
select distinct path from router where name like 'rest.%' and path not like '/entity%' ORDER BY path;
resulting in
Comment #11
clemens.tolboomHaving configured for vocabulary using HAL GET
I get independent of permissions set on "Access GET on Taxonomy vocabulary resource"
Asking for non-existing id aka 'tagss' gives
Guess this is a bug.
Comment #12
klausiAs said above: Taxonomy vocabularies are configuration entities. REST module in its current state only supports content entities, I guess we should document that somewhere.
Comment #13
clemens.tolboom(doh) I read it , forgot it , then ... :-/
What I don't understand is why I can REST call it. Shouldn't rest module restrict to content entities only?
@vivekvpandya maybe ?:
[Stock response from Dreditor templates and macros.]
Please update the issue summary by applying the template from http://drupal.org/node/1155816.
Comment #14
clemens.tolboomI've created #2300677: JSON:API POST/PATCH support for fully validatable config entities as that resolves @vivekvpandya GET
@klausi let's discuss why we shouldn't expose ConfigEntities in #2300677: JSON:API POST/PATCH support for fully validatable config entities
Comment #15
vivekvpandya CreditAttribution: vivekvpandya commented@clemens.tolboom sorry I am new to Drupal and I don't know that REST should not support ConfigEntity. I installed RESTUI custom module and it provides REST end point for that So I tried and get error.
Comment #16
clemens.tolboom@vivekvpandya I use that module too. With that and https://github.com/build2be/drupal-rest-test I managed to POST node and comment ... I could use some help for other POST types. I've created Rest UI #2303369: Until #2300677 is fixed, show in REST UI that config entity resources are read-only
Comment #17
clemens.tolboom@vivekvpandya I guess we can 'closed by design' this 'Support request' now we have #2300677: JSON:API POST/PATCH support for fully validatable config entities ?
As @klausi said its by design and I disagree through mentioned issue.
Comment #18
webchickI think taxonomy is worth talking about in its own right, regardless of what we choose to do / not to do with config entities.
When you dump hal+json from an Article node, this is what you get:
As an implementor, who doesn't know (and shouldn't need to know) Drupal's underlying architecture representation of its data, it is utterly mystifying that uid, revision_uid, and image show up in the list of _links but not the "Tags" field. I would actually rate this a "major" "bug" from the perspective of someone trying to build e.g. a mobile application for Drupal.
If this doesn't belong here, and belongs in some other issue, happy to report it there instead. I think #2300677: JSON:API POST/PATCH support for fully validatable config entities is way too broad, though, and also has possibly security implications as mentioned there, so I doubt we'd want to do that wholesale (in core, at least). But for fields directly attached to content, people are going to expect those to be exposed in the JSON feeds from Drupal.
Comment #19
clemens.tolboom@webchick let's please close this one and move over to the general issue.
Discussing only about taxonomy_vocabulary is not enough. If we expose ConfigEntities maybe we should reduce that list. I really would discuss over @ #2300677: JSON:API POST/PATCH support for fully validatable config entities
Regarding the HAL/Rest UX/DX it indeed is not what one expects. But there are some issues about it in rest.module component.
I myself found more issues which I haven't time to file :-/
Comment #20
clemens.tolboomAs the REST team decided #2300677-11: JSON:API POST/PATCH support for fully validatable config entities to put on hold this issue is postponed on it.
Comment #21
clemens.tolboomI close this as #2300677: JSON:API POST/PATCH support for fully validatable config entities has a GET patch which is quite valid to have for several other resources. It's not really a dub but I see no better option.
Comment #22
clemens.tolboomAdded XREF to #2339795: Add "REST modes", just like we have "view modes" and "form modes" AND depth argument to reduce # of requests mentioned by @webchick in #18.
Comment #23
jacov CreditAttribution: jacov as a volunteer commentedi am re-opening this issue and marking as major.
I agree with @webchick , taxonomy is it's own animal, and should not be bundled in with ConfigEntity #2300677: JSON:API POST/PATCH support for fully validatable config entities
as it currently stands, the taxonomy REST endpoints do not work.
Both produce a 403 Forbidden with error, see curl examples below.
this is a major show stopper for decoupled drupal 8 developers.
* /entity/taxonomy_vocabulary/{taxonomy_vocabulary} produces a 403 and {"error":""}
* /taxonomy/term/{taxonomy_term} produces a 403 Forbidden & null message
(...and yes, i checked permissions, and i have enabled both:
Access GET on Taxonomy term resource
Access GET on Taxonomy vocabulary resource
...)
Comment #24
jacov CreditAttribution: jacov as a volunteer commentedComment #25
jacov CreditAttribution: jacov as a volunteer commentedComment #26
jacov CreditAttribution: jacov as a volunteer commentedComment #27
jacov CreditAttribution: jacov as a volunteer commentedComment #28
Wim LeersPlease do not reopen issues from almost 2 years ago. Please create a new issue.
Comment #29
jacov CreditAttribution: jacov as a volunteer commentedok @Wim-Leers, here you go: #2772413: REST GET fails on entity/taxonomy_vocabulary/{id} 403 Forbidden with error