PowerShell
PowerShell
Example: Http.HttpBinary method
Demonstrates theHttpBinary method.
Chilkat PowerShell Downloads
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
$success = $false
$localFilePath = "C:/example/zips/data.zip"
$bd = New-Object Chilkat.BinData
$success = $bd.LoadFile($localFilePath)
if ($success -eq $false) {
$($bd.LastErrorText)
exit
}
$zipBytes = $bd.GetData()
$url = "https://example.com/api/v1/sites/123/deploys"
# Send a POST with a binary HTTP request body.
$resp = New-Object Chilkat.HttpResponse
$http = New-Object Chilkat.Http
$success = $http.HttpBinary("POST",$url,$zipBytes,"application/zip",$resp)
if ($success -eq $false) {
$($http.LastErrorText)
exit
}
$("Response Status Code: " + $resp.StatusCode)
$("Response body:")
$($resp.BodyStr)