How to POST to a REST API using Fiddler
Posted by robkraft on October 24, 2012
Posting to a REST API using Fiddler is very simple, as long as you fill out all the required values correctly. I spent more than an hour figuring out the correct info for my REST API recently so I am documenting it here for my own sake, and hopefully to speed the resolution for others. The URL shown in the image is not real, so don’t expect that URL to work for yourself.
- Select the Composer tab in Fiddler.
- Select POST from the dropdown.
- Enter the URL of the REST API. My REST API had a .svc extension, but most REST APIs do not.
- In the Request Headers, include “Content-Type: text/xml”. This is the step I missed that took my so long to resolve. Your REST API may not need this, but the REST API I was working with developing on the Microsoft Stack did. You do not need to provide the values for Host or Content-Length in your Request Headers because Fiddler will populate those for you.
- In the Request Body, provide the XML or Json data that you are sending to the URL as part of the POST.
- Click on the Execute button.
- Check the panel on the left (not shown in the image) to see the result of your API call. For my API, the POST returned a 200 and the Response Body contained my response data.
That’s it. Good Luck!