ServiceStack Clients and Ambiguous Routes

Viewed 393

I have a service stack service we'll call Orders that has the standard GET routes

  • /orders - Gets All Customers
  • /orders/{Ids} - Gets Specific customers

This works all fine and dandy, but I thought I'd add another route

  • /orders/customers/{CustomerId} -Gets orders with a specific customer id

This works find when hitting the routes in the browser, but when I use the ServiceStack Client I get ambiguous routes exception, and it lists the three routes.

I'm not quite sure what the best way around this is..is what I'm doing not the correct RESTish way to it?

I know I can simply manual enter the routes into the JsonServiceClient like

client.Get<List<Orders>>("/orders/customers/7")

and that will work, but I would prefer to do it the typed way...i.e

client.Get(new OrdersRequest { CustomerId = 7 });

Here's an example RequestDTO i'm using

public class OrdersRequest : IReturn<List<Orders>>
{
   public int[] Ids {get; set;}
   public CustomerId {get; set;}

   public OrdersRequest(params int[] ids)
   {
        this.Ids = ids;
   }
}

Do I have to use different Dtos for this or...?

any help or pointers to any of the samples that have a way around this, or a better way to create the services would be appreciated.

Thanks

1 Answers
Related