Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The following steps worked for me:
- Enable hal, rest and serializer
- Allow the anonymous user to create page content and Create and edit URL aliases
- Post the following code to
http://d8.dev/entity/node
:
{ "type": [ { "target_id": "article" } ], "title": [ { "value": "Hello world example" } ], "_links": { "type": { "href": "http://d8.dev/rest/type/node/page" } }, "path":[ { "alias": "/example" } ] }
- A new entry was created on 'http:/d8.dev/example'
It is quite hard to get the NID from that
Proposed resolution
Don't use path aliases for the generated URL
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#9 | interdiff.txt | 4.34 KB | dawehner |
#9 | 2610694-9.patch | 7.11 KB | dawehner |
#5 | interdiff.txt | 937 bytes | dawehner |
#5 | 2610694-3.patch | 4.17 KB | dawehner |
#4 | interdiff.txt | 3.28 KB | dawehner |
Comments
Comment #2
dawehnerHere is a patch for this, of course though, we need some tests.
Comment #3
tim.plunkettMakes sense to me. Might as well switch to toUrl() while you're fixing this.
Comment #4
dawehnerThere we go, finally
Comment #5
dawehnerThere we go.
Comment #9
dawehnerJust some additional work, but it seems to be that things aren't that easy.
Comment #10
Wim Leers:P
Oh, the smell of beautiful sarcasm!
Comment #12
BerdirHm. Doing this as a way to get the NID seems like the wrong solution. We have separate issues to return the created data and we have yet another issue to return the ID.
The thing is that with redirect.module (global redirect functionality) or #2641118: Route normalizer: Global Redirect in core, actually trying to access that page will force a redirect to the alias anyway.
Comment #14
dawehnerFair point, I think we can close the issue then.
Comment #15
Wim Leers