Problem/Motivation
If you have an entity with an alias as /my-page there is no way to reliably determine the entity type that this item is associated with. Yes, you can get the data by adding a format to the alias like /my-page?_format=json, but what is the response? is it a node? a taxonomy term?
Likewise, there is no endpoint to translate the alias into a system path.
Proposed resolution
Create an endpoint like /dblog/{id} that allows the retrieval of a path object by id, or by path or alias (query parameter?) with the optional langcode.
I imagine the plugin will be /path/{pid} and {pid} is an optional parameter, but the user must provide either a pid, a path, or an alias, but not more than one.
Alternatively, we could create three endpoints, but it might be odd having an encoded path within a path, I feel that this would be better as a query.
Right now, this will be impossible to cache, because paths do not have cache tags until #2480077: Using the URL alias UI to change aliases doesn't do necessary invalidations: path aliases don't have cache tags.
Remaining tasks
- Write patch by adding the REST Plugin to the
pathmodule
User interface changes
None.
API changes
Adds REST endpoint for Paths.
Data model changes
None.
Comments
Comment #15
smustgrave commentedThank you for sharing your idea for improving Drupal.
We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #17
smustgrave commentedSince there's been no follow up and was a feature request going to close out. If still desired could be re-opened if needed.
Thanks all.