How to get the exact URI, Headers and body for REST API calls for Azure management?

The REST API calls are well documented for Azure.

However, at times when you try to make the REST calls, you get 400 Bad request error message.

To make sure that you are using the right URL, headers and body for the REST call, you can try the following:
1. You can enable debugging for powershell using the following command:
PS C:\> $DebugPreference="Continue"
Azure Powershell uses REST calls.

2. After this run the powershell cmdlet equivalent to the REST API call. Example, I wanted to set the Azure deployment status, I ran the following command:
set-azuredeployment -Status

3. When this cmdlet executed, it showed me the exact REST URL, headers and body that was needed to do the function using REST APIs.
I can use any http tool or code to create HTTP request and make the REST API call. The following is a good blog if you wish to write your own code

PowerShell cmdlet and output:
PS C:\> $DebugPreference="Continue"
PS C:\> set-azuredeployment -Status

cmdlet Set-AzureDeployment at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
ServiceName: test
Slot: production
NewStatus: running
DEBUG: 9:35:58 AM - SetAzureDeploymentCommand begin processing with ParameterSet 'Status'.
DEBUG: ============================ HTTP REQUEST ============================


Absolute Uri:

x-ms-version                  : 2014-04-01
User-Agent                    :
client-tracking-id            : 1

<UpdateDeploymentStatus xmlns="">