Passing complex DTO in Postman

I try write API tests against my ServiceStack server. I have enabled the plugins as described in the documentation. I have to pass a complex DTO in my GET requests, but on the server they are always NULL.

[Route("/v1/sysop/loglevel", "GET", Summary = "Gets the currently active loglevel for a specific instance of the BediSoft Cloud " +
                                              "Administration server.")]
public class GetLogLevel : IReturn<string>
{
	[ApiMember(Name = "RequestMeta", Description = "BediSoft Cloud request meta data object.",
		ParameterType = "path", DataType = "RequestMetaDto", IsRequired = false)]
	public RequestMetaDto RequestMeta { get; set; }
}

The RequestMetaDto is defined as

public class RequestMetaDto
{
	public string CallingRequestId { get; set; }
	public RequestSource Source { get; set; }
        // etc....
}

Just after importing the collections into postman it looks like this:

So I tried to add JSON values for the RequestMetaDto like so:

But no luck, on the server the object is always NULL:

How do I need to pass a complex parameter DTO in Postman so that ServiceStack can correctly serialize it?

You can pass Complex Types in the QueryString or FormData using JSV which for your RequestMeta property would look like:

KEY    RequestMeta
VALUE  {CallingRequestId:"blah"}

Got it, works as expected now. Thanks for the hint!

1 Like