Reputation: 333
I'm working on a project for a mobile device, and trying to keep to an API standard as this will be a an API used by others. Is it appropriate to use the same resource noun in the same resource URI?
For example, for an API that will check if a particular device should be blacklisted from our service: v1.0/device/blacklist/device/
Is it appropriate to use device twice here? I can't seem to find anywhere that mention if this is an appropriate thing to do for API naming conventions. Thanks.
Upvotes: 1
Views: 168
Reputation: 57239
Is it appropriate to use device twice here?
Sure, why not? REST doesn't care what spelling you use for your identifiers, so it certainly shouldn't care that some path-segments have common spellings.
For instance, if you were identifying nodes in a binary tree, an identifier like
/tree/root/left/left/right/left/...
is fine.
The machines don't care what spellings you use; so the only question is whether or not it is acceptable to the humans in your context; in other words, see your local design guidelines.
Upvotes: 2