Samir Chahine Samir Chahine - 4 years ago 147
reST (reStructuredText) Question

How specific does an API's routing need to be?

I'm creating an API, I have a user that I can request by calling:


This works fine.

Say each user had a set of skills, could be one skill or 100.

I want to get all the skills for a specific user.

Would I be super specific and make it so that you'll have to call:


Or does this:

is the user's


Is there a REST API standard I should be following or is it flexible ?

Any advice is highly appreciated, Thank you.

Answer Source

As skills is user's property, let's consider it as sub-resource. Getting sub-resources is based on nesting URL (hierarchical way), so /api/request/user/{id}/skills would be great!

In /api/request/skills/{id} case id should be an identifier of skill to make your API intuitive.

Also remember about naming convention. Be consistent, your skills resource is plural so let's rename user to users.

So, to sum up




would be nice.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download