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.
http://msdn.microsoft.com/en-us/library/azure/ee460799.aspx

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
http://blogs.msdn.com/b/mcsuksoldev/archive/2013/08/08/azure-calling-the-azure-management-rest-api.aspx

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 ============================

HTTP Method:POST

Absolute Uri:
https://management.core.windows.net/0f736ead-5ffa-4cf8-927d-47e7a8f0b/services/hostedservices/test/deploymentslots/Production/?comp=status

Headers:
x-ms-version                  : 2014-04-01
User-Agent                    :
Microsoft.WindowsAzure.Management.Compute.ComputeManagementClient/0.9.0.0,WindowsAzurePowershell/v0.8.0
client-tracking-id            : 1

Body:
<UpdateDeploymentStatus xmlns="http://schemas.microsoft.com/windowsazure">
  <Status>Running</Status>
</UpdateDeploymentStatus>