Skip to content

Instantly share code, notes, and snippets.

@DamianMac
Created October 21, 2014 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DamianMac/1b417012dd1f7dfc49d2 to your computer and use it in GitHub Desktop.
Save DamianMac/1b417012dd1f7dfc49d2 to your computer and use it in GitHub Desktop.
$server = "http://blah"
$apiKey = "API-XXXXXXXXXXXXXXXX"
$command = $($server + "/api/tasks")
$task = @{}
$task.Name = "Backup"
$task.Description = "Backup requested via API"
$body = $task | ConvertTo-Json
$new = Invoke-RestMethod -Method Post -Uri $command -Body $body -Header @{"X-Octopus-ApiKey"=$apiKey}
@mattcorr
Copy link

mattcorr commented Apr 9, 2015

Thanks for this sample! It's very useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment