Last active
September 25, 2018 07:15
-
-
Save RandomNoun7/0451b0d64a74c31145beb256dc8817e0 to your computer and use it in GitHub Desktop.
Pipelines New App Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$apiToken = $env:ApiToken | |
$username = $env:Username | |
$apiUrl = $env:ApiUrl | |
$appsUri = "https://$apiUrl/$Username/apps?apiToken=$ApiToken" | |
$appsCollection = Invoke-RestMethod -Uri $appsUri | |
Write-Output "Existing Apps" | |
Write-Output $appsCollection.apps.name | |
$jsonBody = @{Description = 'An Awesome New App'} | ConvertTo-JSON | |
$newAppName = 'NewApp004' | |
# $NewAppName var is in brackets because we don't want the ? character | |
# interpreted as a part of the variable name. It breaks the URI. | |
$params = @{ | |
Uri = "https://$apiUrl/$username/apps/${newAppName}?apiToken=$apiToken" | |
Method = 'Put' | |
ContentType = 'application/json' | |
Body = $jsonBody | |
} | |
$returnValue = Invoke-RestMethod @params | |
Write-Output "App We Created" | |
Write-Output $returnValue.app.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment