Sujeet Raman

Sujeet Raman

  • 798
  • 915
  • 335.8k

Web api end point is not working in Postman but works in swagger

Jun 18 2021 3:57 AM

after giving this route attribute in class level i cannot test in postman like http://localhost:9001/SaveData and my save is  NOT working

but in swager its automaticaly take /Test/SaveData and my save is working

 

how to configure my post man to test? below is my method in controller


    [ApiController]
    [Route("Test")]

 public class TestDataController : ControllerBase
    {
       
        private readonly ITestData _RegressionTestData;

        public TestDataController(ITestData TestData)
        {
           
            _TestData = TestData;

        }

     

 [HttpPost("SaveData")]
        public async Task SaveData([FromBody] DataModel input)
        {
            if (input == null)
            {
                return new JsonResult("Data input error, please review!");
            }

            var result = await _TestData.SaveData(input);

            return new JsonResult(result);
        }
 


Answers (5)