Problem/Motivation
On a node response, the path is always empty:
"default_langcode": [
{
"value": "1"
}
],
"path": [],
"body": [
{
"value": "<p>TEST</p>\r\n",
"format": "full_html",
"summary": ""
}
],
It looks like this is because the path retrieval is coupled to the form, rather than the API. This prevents the REST API from being able to update an existing URL alias.
The only way to update the alias, is by requesting it (with a view?) and then updating it. If you PUT an alias into the path portion, a new alias will be created and the old one will not be deleted (since the alias' pid is required for an update). :(
Proposed resolution
Move the alias retrieval out of the form and into the field API. This will give the form access to the alias, as well as the REST API. This will also allow the alias to be cached with the entity.
Remaining tasks
- Figure out where the query should take place
- Write Patch
User interface changes
None.
API changes
Path will no longer be empty and instead be filled with the path record.
Data model changes
Path data will now be cached with the entity.
Comments
Comment #2
swentel commentedsee #2649646: Normalize path fields as part of the entity: allow REST clients to know the path alias