Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8737451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:31:33+00:00 2026-06-13T10:31:33+00:00

Say I have a resource parent which represents a set of data. A restful

  • 0

Say I have a resource parent which represents a set of data. A restful URL structure for something like this should be pretty straightforward:

  • GET /api/parents – return collection of all parents
  • GET /api/parents/1 – return parent with id = 1
  • POST /api/parents – add a new parent to the collection
  • PUT /api/parents/1 – update data in parent with id = 1
  • DELETE /api/parents/1 – delete parent with id = 1

Now say that each parent is composed of a collection of child resources. Should the child resources id’s be considered to have global or local scope? I believe the following 2 URL’s are given:

  • GET /api/parents/1/children – return collection of parent 1’s children
  • POST /api/parents/1/children – add new child to parent 1’s collection

But what about GET, PUT and DELETE? Which of the following are appropriate?

  • GET, PUT or DELETE /api/parents/44/children/6
  • GET, PUT or DELETE /api/parents/children/6

It seems like it comes down to the uniqueness scope of the child resource’s ID. Is the ID unique only within the parent aggregate? Or is it unique among all children of all parents? Is one more correct than the other, or does it depend on the id uniqueness scope of the resources in question?

If example 1 is more appropriate than example 2, and parent with id = 44 does not have a child with id = 6 (say child id = 6 belongs to parent with id = 9), what HTTP response should be returned?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:31:34+00:00Added an answer on June 13, 2026 at 10:31 am

    @danludwig

    i do not think it actually matters as far as URIs are just resource identifiers and all these user friendly hierarchies are important only for human beings… but in either case i’d ask question regarding this one “/api/parents/children/6”, lets break it down:

    • GET to “/api/parents/children/6” gives us child resource
    • GET to “/api/parents/children” what happens here? 404?
    • GET to “/api/parents” gives us all parents
    • GET to “/api” hopefully home(or index) document with links to other, subordinated resources.

    I think it’s a good test when constructing hierarchical URIs. Just make sure that each segment is bound to particular resource and doesn’t return 404.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a resource (e.g. a filehandle or network socket) which has to
Let's say I have a resource file which exports mc1 with 4 frames in
Let's say you have a piece of code like: resource = allocateResource(); try {
This is pure curiosity. Let's say I have a resource Users and want to
I have a parent resource and say about 4 child resource (There is a
Let's say I have a nested resource like in the Rails guide example: http://guides.rubyonrails.org/routing.html#nested-resources
Lets say I have a post, this post should have a certian amount of
Lets say I have the following DataMapper resources: class Post include DataMapper::Resource has n,
Consider that I have 1 resource and 2 urls (let's say new one and
i have a table of resources (lets say cars) which i want to claim

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.