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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:51:59+00:00 2026-05-28T16:51:59+00:00

I’m trying to develop a online shopping web service with RESTful. However, I’m so

  • 0

I’m trying to develop a online shopping web service with RESTful. However, I’m so new about this that I don’t know how to design it.

Here is my model:

  • User: includes name, email, phone number …etc
  • Product:includes its name, its tags and what category it belongs to. (I designed two types of Category: MainCategory and SubCategory, where SubCategory belongs to MainCategory).

Now I have the following needs about Product:

  1. List all products under MainCategory M
  2. List all products under MainCategory M and SubCategory S
  3. List all products belongs to a user A
  4. CRUD with the product with product_id

Here is my question about the situation above:

  1. List all products under MainCategory M
    • should I use /products/M or /MainCategory/M to list all the products?
  2. List all products under MainCategory M and SubCategory S
    • should I use /products/M/S or other ways?
  3. List all products belongs to a user A
    • should I use /user/A/products or /products/?user=A or other ways?
  4. CRUD with the product with pid(product_id)
    • is this correct? /product/pid

Besides, what to do if I need to sort or add some restriction?
For example:

  • List all products under MainCategory M, order by time
    • is this /products/M?order=time_asc ?

Thanks for any help!

  • 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-05-28T16:52:00+00:00Added an answer on May 28, 2026 at 4:52 pm

    First of all, you’ve got your principal resources:

    /users/{id}
    /products/{id}
    

    Relationships between these two should be by links, as it makes total sense to think about either without reference to the other (users aren’t owned by products, or vice versa). Use normal CRUD techniques for dealing with these resources, and consider sub-resources for complex attributes.

    Then you’ve got the categorization system. This is also nicely modeled as a resource:

    /category/{name}
    /category/{name}/{subname}
    

    A key difference here is that you don’t need to support any operation other than GET on categories; the information there (a list of the members of the category) is really synthesized from the definitive information on the products. Where you wish to allow people to restrict the set of information returned by the listing (e.g., a limited range, a different ordering) that is done through parameters on the GET. The list of category members should really be a list of links to the relevant product resources.

    If you support user categorization, put that as a separate resource and take care to add appropriate security restrictions; only authorized people should be able to see that sort of thing.

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

Sidebar

Related Questions

I am trying to develop an online translation service (sort of a personal challenge)
Trying to develop using MVVM: I have this Csla.PropertyStatus control that is created in
I am trying to develop an Online editor (like FCKEditor/etc) but I have no
Im trying to develop my first ASP.NET MVC web app and have run into
I am trying to develop a .NET Web Project using NHibernate and Spring.NET, but
I'm trying to develop an application that will use getImageData in javascript in Firefox
I'm trying to develop an online formbuilder. Each user can build their own forms
I'm trying to develop an online application where the user writes some text and
I am trying to develop an application which downloads online music data (music files)
I'm trying to develop a shopping cart for a website for a class project.

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.