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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:26:07+00:00 2026-06-17T09:26:07+00:00

Suppose that I have a nested one to many -type hierarchy database as follows:

  • 0

Suppose that I have a nested one to many-type hierarchy database as follows:

One Region has many Countries; each Country has many Cities; a City must belong to one and only one country.

Abstracting this information into a RDBMS is a trivial exercise, but (to my mind) the most sensible REST endpoint to return a list of countries for a given region id would be something like the following:

HTTP GET http://localhost/Region/3/Countries

By default, the .NET Web API’s routing would be, at best, http://localhost/Countries/Region/3 or http://localhost/Region/Countries/3.

Is there a sensible naming-convention I should follow, or is the routing customisable enough to allow URIs to take any shape I like?

  • 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-17T09:26:08+00:00Added an answer on June 17, 2026 at 9:26 am

    The routing should be customizable enough to get the URLs you’re looking for. Assuming you want URLs in the form ‘http://localhost/Region/3/Countries’, you could register this custom route:

    config.Routes.MapHttpRoute("MyRoute", "Region/{regionId}/Countries", new { controller = "Region", action = "GetCountries" });
    

    This would dispatch requests to the ‘GetCountries’ action on the ‘RegionController’ class. You can have a regionId parameter on the action that gets model bound automatically for you from the URI.

    You may want to look online for the attribute routing package for WebAPI since it may be more appropriate in your case.

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

Sidebar

Related Questions

suppose you have a class Product, with members that are declared as nested type
Suppose that I have a database with student information: {'student_name' : 'Alen', 'subjects' :
Suppose I have a nested list as the one below: [[['a'],[24],214,1] ,[['b'],[24],312,1] ,[['a'],[24],3124,1] ,
Suppose I have an instance method that contains a lot of nested conditionals. What
Suppose we have classes Gallery and Image. There can be many images in one
Suppose we have an iterator (an infinite one) that returns lists (or finite iterators),
Suppose I have a table called Companies that has a DepartmentID column. There's also
Suppose that you have a function f: List a -> a such that f
Suppose that I have a 2D array (matrix) in Java like this... int[][] MyMat
Suppose that we have following tables create table Employee( 2 EMPNO NUMBER(3), 3 ENAME

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.