DEV Community

Discussion on: Should RESTful API URL be clean (/api/:param)?

Collapse
 
ale_jacques profile image
Alexandre Jacques

REST stands for REsource State Transfer (en.wikipedia.org/wiki/Representati...) being "resource" the keyword here. URI's uses the resource name (article in you example) to identify the resource being "mutated".

That´s why RESTful URLs have this format. That being said, resource names are not a security risk by themselves. Identifiers, OTOH, are quite indicative so, for that, you can rely on a numerous strategies to hide (or minimize) the exposure of you resources (hashes, UUIDs, etc.).

Again, RESTful approach uses HTTP verbs as the mechanism to achieve the "state transfer". It's argumentative that this would be a security risk since the web is based on HTTP and its verbs. And, by itself, REST is just one way of doing things.

Querystring is easier but it poses a much higher security risks since all data traffic is exposed on the URL and not even encrypted by HTTPS.

And, finally, REST is not about SEO. Usually REST URLs are not public facing websites. They should only be used to access some sort of REST APIs and be protected by tokens and other security mechanisms (HTTPS, API keys, Oauth2) meaning, they would and should not be indexed by search engines.

Hope it helps understand the meaning of things.