Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Hit Delete API of MVC5

    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 684
    Answer it

    Hi,

    I am trying to hit a MVC web API for deleting the record but i am getting the error that no resource found. I am able to hit the API using PostMan and fiddler but i am unable to hit it using Rest Clinet. Here is my code

    var request = new RestRequest("api/TwingleCategory/DeleteCategory", Method.DELETE);
     request.AddParameter("twingleCategoryId", twingleCategoryId, ParameterType.UrlSegment);
     var response = _client.Execute(request);
    

 1 Answer(s)

  • Hi Abhishek,
                        few days back, I also faced the same problem, the solution I got was instead of using ParameterType.UrlSegment, I used, ParameterType.QueryString.
    Your code should look as follows:

    var request = new RestRequest("api/TwingleCategory/DeleteCategory", Method.DELETE);
    request.AddParameter("twingleCategoryId", twingleCategoryId, ParameterType.QueryString);
    var response = _client.Execute(request);
    

    Hope it helps you.....!

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: