Share via


Calling SharePoint REST API with POST from Fiddler

This is a quick one act drama about how to use Fiddler to issue POST requests to a SharePoint REST API.

Act 1

Fiddler has a nice feature called Composer which can be used to create your own request with your own verb, header and content information.

Certain SharePoint web services will require GET, others POST calls. The POST call is just slightly different from a GET. There are a few things you need to keep in mind:

  1. Fiddler cannot authenticate against POST, so you should have a cookie available.
  2. You need to post an X-RequestDigest header.
  3. You might need to have a payload in the Message Body.

How you do the authentication, is up to you, as for me, I just issue a query from a browser, record the traffic, steal the cookie information and there you go. In theory Fiddler does the authentication for you (If you have the checkbox Automatically Authenticate set on the Options tab.) but that did not work reliably for me for SPO, so I dropped it.

So to get the Request Digest token, you just call a POST query against the _api/contextinfo web service.

Calling ContextInfo from Fiddler

The information will be in the FormDigestValue attribute:

FormDigestValue in the response

Now you can put this information into your next POST request's header and there you go, you can test the API's behavior.

POST call to an SPO web service