Home Is it correct to use self/current in a rest api url?
Reply: 1

Is it correct to use self/current in a rest api url?

Venkata Jaswanth
Venkata Jaswanth Published in 2017-12-07 08:42:21Z

For example let's say I have a url like /projects/{projectId}/progress.

Now, lets say a user can only be in one project. if the server already knows which project the user belongs to based on the context, do we need to pass the projectId or can we put the url as /projects/current/progress since we wouldn't be using the projectId even if it is passed.

Just want to know if it is a good practice or not.

Cassio Mazzochi Molin
Cassio Mazzochi Molin Reply to 2017-12-07 09:33:49Z

A resource can have multiple identifiers and nothing stops you from using a static mapping such as /projects/{projectId}/progress and a mapping that depends on a context such as /projects/current/progress.

A similar topic has been discussed here, here and here.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.311853 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO