Invoke Asp.Net Web API POST Method using Fiddler

At Invoke Asp.Net Web API GET Method using Fiddler, we discussed how to invoke the REST API GET() method using the Fiddler tool. Today we discuss how to create a new resource by invoking the Asp.Net Web API POST method using Fiddler.

In the previous article, we created the POST method to add a new employee to the database. We invoke the same POST method through Fiddler. Run the API and provide the inputs on the Fiddler composer tab, as shown below.

As shown above, we have changed the HTTP method to POST and added the Accept & Content-type as application/json in the request header as we are sending and receiving the request and response in JSON format. You are not required to mention content-length, Fiddler will take care. In the Request Body field, we have provided the new employee data in JSON format like below.

{
       name:"Raj",
       country:"United States"
}

Now click on the Execute button, you will get status code as 201 (Created) as shown below. By double click on the status code, you can see employee id as a response. For me, I got the response as “JSON=5,” where 5 is the newly added employee id.