I have an action in Web API with a route like the following:
/users/{userId}/friends
And I want to post a value to it with the following action:
[ActionName("friends")]
public IHttpActionResult Friends2(string userId, [FromBody]string friendId)
I am posting JSON like:
{ "friendId": "123" }
However, the friendId is always null. I think this is because Web API only allows 1 parameter when specifying [FromBody].
So how can I post to this action with the userId coming from the querystring and the friendId coming as JSON in the body?