As you know, strictly speaking, there is no advantage between both approaches. Yes, string identifiers may be easier to remember, but apart from this, REST does not use โprettyโ URLs (or identifiers), since most URLs refer to programs that follow hyperlinks.
Therefore, human-friendly URLs should only be used to download resources that people can remember. Also, guessing the ID should not be a problem, because either:
- You must restrict access to URLs based on any authentication method or:
- You must use randomized / unrecognized URLs that are not "public".
So which one to use? In most cases, this does not matter, since identifiers are not directly accessible. If for some reason you need to remember your URLs, try to make them convenient for people, but try to avoid changing the name of the resource and use other authentication methods so that even guessed URLs do not gain access to unauthorized places.
source share