What does the request body look like?

I have a WCF service with a method that looks like this (returns null for testing with a debugger, I only care about getting data now):

[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "fares", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
public List<Fare> GetFares(Dictionary<int, int> itineraries, decimal? threshold, bool includeInternational)
{
    return null;
}

I am trying to access this method using Fiddler, but I cannot figure out what should be the correct Request Body. I can change the dictionary option to something else if this works better.

In the request headers I pass:

User Agent: Fiddler
Content-Type: application / json; encoding = UTF-8

What should I put in the body?

+5
source share
1 answer

I think this is what you need.

{
"itineraries" : [{"Key":1,"Value":2},{"Key":2,"Value":3}],
"threshold" : 1.0,
"includeInternational" : true
}

The dictionary is serialized as an array of key values.

+7

All Articles