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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:06:37+00:00 2026-06-12T16:06:37+00:00

With the older version SomeService : RestServiceBase can match OnGet OnPost OnPut OnDelete actions

  • 0

With the older version SomeService : RestServiceBase can match OnGet OnPost OnPut OnDelete actions with the coresponding incoming verbs.

With the newer version, say I have the following:

//-----------------------------------------
[Route("/todos/{id}","GET")] //display request
[Route("/todos/{id}", "POST")] //edit request
public class Todo : IReturn<TodoResponse> {
    public long Id { get; set; }
    public string Content { get; set; }
}

public class TodoService : Service {
    public object Get(Todo request) { ... } // will GET verb know this Get() function?
    public object Post(Todo request) { ... }// will POST verb know this Post() function?
}

The Action names “Get” “Post” are no longer marked “override”, how does SS match the correct verbs to hit Get() and Post() functions?

//————————————————————————–

Or Round 2, now I have a modification…

//-----------------------------------------
[Route("/todos/{id}","GET")] //display request
public class DisplayTodo : IReturn<TodoResponse> {
    public long Id { get; set; }
}
[Route("/todos/{id}", "POST")] //edit request
public class EditTodo : IReturn<TodoResponse> {
    public long Id { get; set; }
    public string Content { get; set; }
}

public class TodoService : Service {
    //different request DTOs this time ...
    public object Get(DisplayTodo request) { ... } //again, same route "/todos/{id}" 
    public object Post(EditTodo request) { ... }   //will SS get confused about the verbs? 
}

Under the same route “/todos/{id}” how does SS distinguish verbs in the above cases?

Could you please sort me out with the 2 questions? Thank you!

  • 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-12T16:06:39+00:00Added an answer on June 12, 2026 at 4:06 pm

    This is the Smart Routing section taken from the New API wiki page:

    Matching Rules

    For the most part you won’t need to know about this as ServiceStack’s routing works as you would expect. Although this should still serve as a good reference to describe the resolution order of ServiceStack’s Routes:

    1. Any exact Literal Matches are used first
    2. Exact Verb match is preferred over All Verbs
    3. The more variables in your route the less weighting it has
    4. When Routes have the same weight, the order is determined by the position of the Action in the service or Order of Registration (FIFO)

    These Rules only come into play when there are multiple routes that matches the pathInfo of an incoming request.

    Lets see some examples of these rules in action using the routes defined in the new API Design test suite:

    [Route("/reqstars")]
    public class Reqstar {}
    
    [Route("/reqstars", "GET")]
    public class AllReqstars {}
    
    [Route("/reqstars/{Id}", "GET")]
    public class GetReqstar {}
    
    [Route("/reqstars/{Id}/{Field}")]
    public class ViewReqstar {}
    
    [Route("/reqstars/{Id}/delete")]
    public class DeleteReqstar {}
    
    [Route("/reqstars/{Id}", "PATCH")]
    public class UpdateReqstar {}
    
    [Route("/reqstars/reset")]
    public class ResetReqstar {}
    
    [Route("/reqstars/search")]
    [Route("/reqstars/aged/{Age}")]
    public class SearchReqstars {}
    

    These are results for these HTTP Requests

    GET   /reqstars           =>    AllReqstars
    POST  /reqstars           =>    Reqstar
    GET   /reqstars/search    =>    SearchReqstars
    GET   /reqstars/reset     =>    ResetReqstar
    PATCH /reqstars/reset     =>    ResetReqstar
    PATCH /reqstars/1         =>    UpdateReqstar
    GET   /reqstars/1         =>    GetReqstar
    GET   /reqstars/1/delete  =>    DeleteReqstar
    GET   /reqstars/1/foo     =>    ViewReqstar
    

    And if there were multiple of the exact same routes declared like:

    [Route("/req/{Id}", "GET")]
    public class Req2 {}
    
    [Route("/req/{Id}", "GET")]
    public class Req1 {}
    
    public class MyService : Service {
        public object Get(Req1 request) { ... }     
        public object Get(Req2 request) { ... }     
    }
    

    The Route on the Action that was declared first gets selected, i.e:

    GET /req/1              => Req1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a situation where a user can install an older version of my
I notice in older version of flash you can create an instance of a
I'm using an older version of jquery (1.6.2) and can't seem to get delegate
In an older version of Eclipse, the number of which I can't remember, there
I have two different version of a website, an older version, and a newer
I can't use the Get*Profile functions because I'm using an older version of the
My server uses an older version of PHP, so I unfortunately can't use the
Xcode now have built-in version control system. how I can check out older version
Is there any reason I can't use an older version of Data Access Application
In older version of python, 'str' object has no attribute 'format error will be

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.