I have a WCF service with a method which looks like this (returns null for testing with the debugger, I care only about getting data in for 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 make a request to that method using Fiddler, but can't get my head around on what the correct Request Body should be. I could change the Dictionary parameter to something else if that works better.
In Request Headers I pass:
User-Agent: Fiddler
Content-Type: application/json; charset=utf-8
What should I put in the body?
I think this is what you are after.
{
"itineraries" : [{"Key":1,"Value":2},{"Key":2,"Value":3}],
"threshold" : 1.0,
"includeInternational" : true
}
The dictionary serializes as a Key Value array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With