How to Create [Authorize] API...?
What Use [FromBody] in API...& How to Using FromBody Create API ....?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Shweta LodhaRank #31 · 39.8K reputationPosted Jul 30, 2018, 1:09 AM EDT
Ruchi SharavatRank #1,714 · 885 reputationPosted Jul 30, 2018, 1:17 AM EDT
Jenith ThakkarRank #789 · 2.9K reputationPosted Jul 30, 2018, 1:17 AM EDT
If you want to create Role Based Api then use Authorise.
[Authorise(Role="Admin")]
[HttpPost]
public HttpResponseMessage Index([FromBody] IndexViewModel)
{
return Ok();
}
Hardik DeshaniRank #881 · 2.5K reputationPosted Aug 2, 2018, 7:42 PM EDT
Below is sample link for creating WebAPI in MVC
https://atozsourcecode.com/BlogPost/Index/cffb4057-1a07-4f81-bd88-35b7c2c8c295/how-to-create-simple-web-api-step-by-step-and-how-to-call-api-from-browser
I hope above link is help you