By Evgeny_Yudkin on
Hello!
Try to understand the drupal 8 rest api.
One of the most weird things for me - its why non-canonical url path has the key "https://www.drupal.org/link-relations/create" ?
I mean, following code looks more logical:
* uri_paths = {
* "canonical" = "/entity/{entity_type}/{entity}",
* "create" = "/entity/{entity_type}"
* }
As I see, this key used only as a string in a ResourceBase::routes() method. There are no information or functionality at https://www.drupal.org/link-relations/create.
Also, I can not find any commentaries about in in code or in documentation.
So, why?
Can somebody explain this to me, please?
Comments
I think it may be removed entirely
@see: #2113345: Define a mechanism for custom link relationships. I think it is addressing the whole idea of that key.
http://blog.marceisaacson.com
Or maybe it's not removed
@see: https://www.drupal.org/docs/8/api/restful-web-services-api/restful-web-s...
It has something to do with the difference between the path for GET | PATCH | DELETE and for POST.
http://blog.marceisaacson.com
Actually, I guess I'm still not answering your question
I guess you are suggesting a different value for the key. Use simply "create" instead of the FQDN.
http://blog.marceisaacson.com
create key now exists in ResourceBase.php
As I was implementing a POST method today for D9, I looked into ResourceBase.php and found that the "create" key is now supported. Happy!
Looks like this has changed
Looks like this has changed to 'create' in Drupal 9
https://www.drupal.org/project/drupal/issues/2802677
--
www.zyxware.com