Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Krishna Santosh Vatsavai 9 posts 79 karma points
    Aug 09, 2018 @ 04:37
    Krishna Santosh Vatsavai
    0

    Web Api Post not working

    While trying to call the POST it is hitting the GET. I checked all the routing configuration and everything looks OK. Has anyone faced such issue before?

  • Louis Ferreira 69 posts 265 karma points
    Aug 09, 2018 @ 06:00
    Louis Ferreira
    0

    Hi Krishna,

    Can you post up your controller code for us to see what's going on? There could be a number of things causing this.

    Louis

  • Krishna Santosh Vatsavai 9 posts 79 karma points
    Aug 13, 2018 @ 21:35
    Krishna Santosh Vatsavai
    0

    public class AccpacImportController : ApiController { private readonly IAccpacImportService _accpacImportService;

        public AccpacImportController()
        {
            _accpacImportService = new AccpacImportService();
        }
    
    
    
    
        [HttpGet]
        [Route("FooBar2")]
        public IHttpActionResult FooBar2Get()
        {
            return Ok();
        }
    
        [HttpPost]
        [Route("FooBar2")]
        public IHttpActionResult FooBar2()
        {
            return Ok();
        }
    
        [HttpPost]
        [Route("FooBar")]
        public IHttpActionResult FooBar()
        {
            return Ok();
        }
    
    
    }
    
  • Krishna Santosh Vatsavai 9 posts 79 karma points
    Aug 13, 2018 @ 21:36
    Krishna Santosh Vatsavai
    0

    All the route config seems to be OK.

  • suman 30 posts 101 karma points
    Aug 14, 2018 @ 12:46
    suman
    0

    I tried by inheriting "UmbracoApiController" and it is working as expected. (request made from Postman) and Below code...

    enter image description here

Please Sign in or register to post replies

Write your reply to:

Draft