URL Shortener Microservice question

URL Shortener Microservice question
0

#1

Hello everyone,
according to RESTFul API best practices,
[project_url]/api/shorturl/new
should really be
[project_url]/api/shorturl
since we are already using the POST method which has the meaning to create new subordinate resources.
Am I missing something?
I think this is just wrong and that we should change that.


#2

The endpoint/route is kind of arbitrary. I’m just finishing this project and I am using the endpoint they tell you to use because I am guessing it might be used as part of the testing they have setup.

I’m not sure on that but I decided to keep the endpoint that way just in case.


#3

For one thing, I don’t know if there is an actual “API best practices standard”. If there is, please link it - I’d love to read it.

Your point is reasonable but I’m not sure I agree 100%. You’re probably right that it is redundant. I would also point out that it’s not uncommon for people to use POST for things besides creating new entries and adding new on there makes it explicit. I don’t know how others think, but I could argue it either way.


#4

You are right, there is no standard defining how an API should be built.
But there are tons of very good and documented best practices that all of us should follow.
And I think that here on FreeCodeCamp we should encourage them.
Here are some of the resources I’ve found very helpful: