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

patarapolw

Pacharapol Withayasakpunt

Posted on August 9, 2020

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

Clean URL is https://en.wikipedia.org/wiki/Clean_URL

A common pattern is

GET /articles
POST /articles
PUT /articles/:id
DELETE /articles/:id
Enter fullscreen mode Exit fullscreen mode

Completely understandable, if you are doing it for SEO, but do RESTful API even need that? There might even be a security risk.

Some tutorials seem to explicitly prefer this, but why?

Actually, if querystring is used instead, it might be easier for axios + TypeScript (or any URL builders).

💖 💪 🙅 🚩
patarapolw
Pacharapol Withayasakpunt

Posted on August 9, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related