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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:33:45+00:00 2026-05-25T22:33:45+00:00

Is the following URI good in REST or how can it be improved? This

  • 0

Is the following URI good in REST or how can it be improved?

This is the service definition: (REST and SOAP – WCF)

    [OperationContract]
    [WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate = "/Services?CostCentreNo={CostCentreNo}&Filter={Filter}")]
    List<Services> GetServices(Int32 CostCentreNo, Int32 Filter);

This would give an example URI as:

    http://paul-hp:1337/WCF.IService.svc/rest/Services?CostCentreNo=1&Filter=1

I have a lot of get methods.
and a few insert methods. Is the URI acceptable. Does it need GET/ in it or something?

edit:
Okay, now i undstand it more:
So If I had a sub service, it would(could) be

    /CostCenters/{CostCentreNo}/Services/{ServiceID}/SubService 

and, Insert Room booking (with over 20 parameters) could be

   /CostCentres/{CostCentreNo}/Rooms/{RoomNo}/Booking?param1={param1}....&param20=‌​{param20}  
  • 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-25T22:33:45+00:00Added an answer on May 25, 2026 at 10:33 pm

    hmm… one of the reasons folks use REST is to avoid query strings for anything other than actual queries. In your case, a CostCentre probably deserves its own URL, as well as a separate URL for its services. Based on your example, in my opinion only the Filter should be a query string.

    I would structure your URL as follows:

    /CostCenters/{CostCentreNo}/Services?Filter={Filter}
    

    Edit:

    Okay, now i undstand it more: So If I had a sub service, it
    would(could) be

    /CostCenters/{CostCentreNo}/Services/{ServiceID}/SubService  and,
    

    Insert Room booking (with over 20 parameters) could be

    /CostCentres/{CostCentreNo}/Rooms/{RoomNo}/Booking?param1={param1}....&param20=‌​{param20}
    

    I would recommend granting individual entities that can exist on their own URLs that are closer to the parent hierarchy, if possible. Obviously I don’t know your system, but my guess is that you might want to do something along the lines of:

    /CostCenters/{CostCenterNo}
    /Services/{ServiceID}
    /Rooms/{RoomNo}
    

    Only use hierarchies like

    /CostCenters/{CostCentreNo}/Services/{ServiceID}/
    

    when a Service cannot exist without a CostCenter. If that is the case, by all means, go with such a hierarchy. If a Service can exist without a CostCenter, go with the former hierarchy above.

    One last thing. This URL from your example:

    /CostCenters/{CostCentreNo}/Services/{ServiceID}/SubService 
    

    only makes sense if a Service can have one and only one SubService. I’m betting that your example needs a SubServiceID or something similar. And following my advice above, I would definitely say that a SubService absolutely would need to be extending a Service URL, e.g.:

    /Services/{ServiceID}/SubServices/{SubServiceID}
    

    In the above case, I would expect that a SubServiceID references the same entity pool as ServiceID, and that whatever data or view is returned by this URL would include both the Service and SubService.

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

Sidebar

Related Questions

Given the Following Code how Would i Change/Set my Silverlight WCF Service URI in
I'm trying to parse the following URI : http://translate.google.com/#zh-CN|en|你 but got this error message
I have a small I have just written which uses the following uri template.
I currently register a content observer on the following URI content://sms/ to listen out
My web-app is hosted on mydomain , with the following URI associated with the
The following code throws System.UriFormatException: var uri = new UriBuilder(ftp://user:pass#word@ftp.somewhere.com:21/fu/bar.zip); System.UriFormatException: Invalid URI: A
The following URL https://developers.geoloqi.com/account/applications/new asks Name,Description,image,Redirect URI etc. P12 Certificate,P12 Password ,APNS Mode. Can
I need to convert all of the following forms into .NET Uri object: hello.world
I'm using following code to locate location on default google map. Uri uri =
I need to identify users according to an URI subset. It has the following

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.