Using wildcards (*) in REST API resource name

Viewed 14785

Is it sensible to use * in REST API for a resource ID? I want to use it for searching. I'm using RESTEasy for developing my webservice.

Suppose I have resources that are user and user has Name and Age. Then my REST API looks like:

/users/{id}/name
/users/{id}/age

Now if I want to display all names I'm thinking on using the following:

/users/*/name

Is this correct or should I use another way of doing?

Edit 1: Adding subresources

As from an answer it is suggested to use a fields query param. But let's suppose I'm now want something that is a property of the sub-resource. For instance:

/user/*/name/full
/user/*/name/short

If I follow the fields option, I will have to do:

/user?fields=name-short 
/user?fields=name-full 

Which it is not nice as the properties of name are linked to the name class somehow.

Please do consider the example as that. Try to get the idea ;)

1 Answers
Related