1

I have an API with two params, the first is from URI the second from the Body, the generated doc with swagger take all params from URI, it doesn't put the body params in the body. Is it a limit for swagger or should I add some configuration?

public IHttpActionResult Put([FromUri] string id, [FromBody] string name, [FromBody] bool activate = false) { return Ok(); } 

Thanks.

2
  • Can you post your source code? Commented Nov 8, 2018 at 14:04
  • I added the API code Commented Nov 8, 2018 at 14:18

1 Answer 1

2

You cannot have more than one [FromBody] used in your method signature. If you have multiple values, you should just encapsulate into an object to your liking :)

https://learn.microsoft.com/en-us/aspnet/web-api/overview/formats-and-model-binding/parameter-binding-in-aspnet-web-api

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.