Dropbox API Getting account information for the linked user via HttpWebRequest in PowerShell


Example

$url = "https://api.dropboxapi.com/2/users/get_current_account"

$req = [System.Net.HttpWebRequest]::Create($url)
$req.headers["Authorization"] = "Bearer <ACCESS_TOKEN>"
$req.Method = "POST"

$res = $req.GetResponse()
Write-Host "Response Status Code: "$res.StatusCode
Write-Host "Response Status Description: "$res.StatusDescription
$readStream = new-object System.IO.StreamReader $res.GetResponseStream()
$result = $readStream.ReadToEnd() | ConvertFrom-Json
Write-Host $result
$readStream.Close()
$res.Close()

<ACCESS_TOKEN> should be replaced with your access token.