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 8220805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:40:10+00:00 2026-06-07T13:40:10+00:00

Is this a good structure for REST URLs? Assuming: GET /account <- get list

  • 0

Is this a good structure for REST URLs?

Assuming:

GET /account  <- get list of accounts
GET /account/1234 <- get account 1234

etc.

If the account resource has a collection that I want to interface, is this a good idea?

GET /account/1234/note <- get notes for account 1234
POST /account/1234/note <- add note to account 1234
DELETE /account/1234/note/321 <- delete note 321 on account 1234

Especially that last one gives me pause; typically I wouldn’t require both the entity ID and the parent ID when deleting.

Or maybe something like this would be better?

GET /account-note/1234 <- get notes for account 1234
POST /account-note/1234 <- add note to account 1234
DELETE /account-note/321 <- delete note 321 on account 1234 (b/c note 321 is on account 1234)

But then I’d end up with a pretty shallow URL set.

Thanks

  • 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-07T13:40:12+00:00Added an answer on June 7, 2026 at 1:40 pm

    I referenced this question in my comments on another question and between the feedback I got there and my own research this is what I’ve come up with.

    Firstly, the question is sort of flawed. RESTful APIs, or to use the perferable term Hypermedia APIs should include the urls of related actions so that the interface is discoverable and changes won’t break existing clients, therefore the exact structure has significantly less importance than I was placing on it, these can be changed later.

    Secondly, the note in the example will be retrieved as part of an account query, maybe something like this:

    <account>
       ...
       <notes>
          <note>
             ...
             <link href="/account-note/123" rel="note">
          </note>
       </notes>
    </account>
    

    The client will never be assembling urls to the account on their own, the client will use the link provided. Since the note ID is globally unique in this case, there is no need to include the key twice. Hence the answer to the question is no, the first example is not a good REST url structure, the second one is better. (Although still maybe not the best…)

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

Sidebar

Related Questions

This StackOverflow question gave me food for thought on what is a good structure
Perhaps this structure is not a good fit for Meteor, or maybe I'm thinking
Is this good OO Design assuming you want every inheriting class to be a
Is this a good approach to filtering a backbone collection on multiple attributes: filterData:
Ok, I have an app as described in this post: https://stackoverflow.com/questions/1623105/good-database-structure-for-a-new-web-app I've prepared a
I am looking at a website which has a good URL structure and URL
I have a directory structure to store the source files. Is this the good
is this good code? can it be simplified somehow? SELECT u.id,u.title,u.title,u.first,u.last FROM (((tblusers u
Is this good practice? Storing objects accessed by a constant. There are plenty of
I read this good article about Routed Events, and I understood why we need

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.