Defining a ServiceStack Route for an Array Parameter

I have a service that will return the top N sales items, given a bunch of different criteria. So, if I have a GET route, how do I set up a route to process an array of a specific parameter?

Top 100 items for groups A, C, D, E, F for the current week. Top 100 items for the store 1,10,11,18,40 for the current month.

How can a route be structured to handle this?

+7
source share
1 answer

It is already connected to you. For an example of groups, a route declaration would look like this:

Items/{Groups} 

DTO elements will need this property.

 public string[] Groups { get; set; } 

Then you can simply call it like this: / Items / A, C, D, E, F

The array will be filled correctly.

+8
source

All Articles