2

Can I set my request object by http parameters with GET method, if request contains not primitive object. I can do it for POST method with json, but does exist some GET alternative?

[DataContract]
[RestService("/foo")]    
public class FooRequest  
{
    [DataMember]
    public string Color1 { get; set; }


    [DataMember]
    public FooDto Dto { get; set; }

}

public class FooDto
{
    public string Color2 { get; set;}
}

In this example Color1 is set but how can I set Dto.color2?

http://server/fooservice/servicestack/foo?Color1=blue&Dto.Color2=red 
Chris Laplante
  • 29,338
  • 17
  • 103
  • 134
vaclamar
  • 165
  • 2
  • 6

1 Answers1

0

In ServiceStack, you can set complex type properties on a QueryString by using the JSV Format. See this earlier answer for an example.

So to set the Complex Type Dto property your queryString would look like:

http://server/fooservice/servicestack/foo?Color1=blue&Dto={Color2:red} 
Community
  • 1
  • 1
mythz
  • 141,670
  • 29
  • 246
  • 390