how to define rest urls for child objects

Both of your examples are fine. General purpose components don’t care whether or not your resource identifiers use spellings that match the names you use in your private internal storage.

So you can use whatever spellings are convenient for your human beings.

This might mean preferring

  • spellings that are easy to document for consumers
  • spellings that are easy to route, internally
  • spellings that are easy to recognize, when you are reading an access log
  • none of the above.

The path part of a URI is fundamentally hierarchical – it may be convenient to choose spellings that allow you to use dot segments to reference other resources.


Keep in mind that you data model and your resource model are different things, and should be allowed to change independently. If changes to your table names also force changes to your resource identifier spellings, someone, somewhere, is probably going to have a bad time.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top