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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:41:57+00:00 2026-06-12T09:41:57+00:00

Having trouble coming up with a good URL path for the case in which

  • 0

Having trouble coming up with a good URL path for the case in which the same RESTful resource (model) is associated in two or more different ways with another RESTful resource, e.g.:

  • Specify a URL path that intuitively represents a request to look up all instances of training sessions associated with a certain trainer, where the TrainingSession model has a trainer_id that is an association to the Employee model.
  • Specify a URL path that intuitively represents a request to look up all instances of training sessions associated with a certain trainee, where the TrainingSession model has a trainee_id that is also an association to the Employee model.

Including “trainees” or “trainers” in the path of the URL doesn’t seem to be right, since they aren’t real resources (only TrainingSession and Employee are):

  • /trainees/1/training_sessions
  • /trainers/1/training_sessions

But, using “employees” is too ambiguous and could mean either:

  • /employees/1/training_sessions

What would you suggest for these routes/paths and why?

  • 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-12T09:41:58+00:00Added an answer on June 12, 2026 at 9:41 am

    Actually using trainees and trainers is not wrong at all.

    Your trainees and trainers both urls can map to the employee controller function which then find the trainee / trainer data using the id provided. I don’t see why you could not do that. It is simply smart url directing.

    If you had to store information about trainees and trainers seperately then they need their own model. But if TrainingSession has trainee id and trainer id which maps directly to employee ids and you don’t have to store anything else about the trainee and trainer I don’t see why the mentioned approach is not usable.

    EDIT: The following is a matter of philosophy and therefore largely debatable.

    I feel the REST principles is for the API user. So as long as user sees that there is a trainee resource and trainer resource and can manipulate it it is REST. How you implement inside, say using MVC is your choice. A good way would be to use MVC principles but principles are guidelines and no golden rules can be applied to all situations. I think creating virtual resources is just fine and they don’t have to map to models / controllers of their own.

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

Sidebar

Related Questions

So I'm having trouble coming up with a good Regex pattern to remove a
I have more of a .NET background, so I've been having some trouble coming
I am having trouble in coming up with a good idea on how to
I'm having trouble coming up with a query that will find all customers who
I'm having trouble coming up with a solution for the following problem and i
sorry about the funky title, I was having trouble coming up with one. First
I'm having some trouble coming up with a sound design for what to me
I'm coming from Java/C++ to Ada and am having trouble figuring out the small
I am coming at Javascript from a classical OOP background and am having trouble
Im having trouble coming up with a way to secure an installer for an

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.