Skip to content

Instantly share code, notes, and snippets.

@HowardvanRooijen
Created July 14, 2014 09:11
Show Gist options
  • Save HowardvanRooijen/4313af807f8405b1b01b to your computer and use it in GitHub Desktop.
Save HowardvanRooijen/4313af807f8405b1b01b to your computer and use it in GitHub Desktop.
try
{
$body = "";
if ([String]::IsNullOrEmpty($apiKey)){
throw "API Key is required"
} else {
$headers += @{"x-api-key"=($apiKey)};
}
if ([String]::IsNullOrEmpty($appName)){
throw "App Name is required"
} else {
$body += "deployment[app_name]=$appName";
}
if (![String]::IsNullOrEmpty($changeLog)){
$body += "&deployment[changelog]=$changeLog";
}
if (![String]::IsNullOrEmpty($description)){
$body += "&deployment[description]=$description";
}
if (![String]::IsNullOrEmpty($environment)){
$body += "&deployment[environment]=$environment";
}
if (![String]::IsNullOrEmpty($revision)){
$body += "&deployment[revision]=$revision";
}
if (![String]::IsNullOrEmpty($user)){
$body += "&deployment[user]=$user";
}
$result = Invoke-RestMethod -Uri $url -Headers $headers -Body $body
Write-Host $result
}
catch
{
Write-Error $_
[System.Environment]::Exit(1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment