© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
2 replies
stevie

How to organize API routes?

There is a .NET 6 WebApi with 2 controllers:

PlatformsController and OrdersController.

Now, in order to get orders, passing platformId is mandatory.

/orders/{platformId}


But ideally the api route would look like:

/platforms/{platformId}/orders/{orderId}.

But since orders must belong to platforms I'm forced to use 1 controller - PlatformsController.

But in this case everything will have to be inside PlatformsController and swagger will show only one controller and won't be separated by orders for example. How to get around this?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to organize my code ?
C#CC# / help
2y ago
❔ How to organize Windows Forms application
C#CC# / help
3y ago
API Routes structure
C#CC# / help
2y ago
❔ How to organize folder structure in .NET with HotChocolate 13
C#CC# / help
3y ago