Last active
February 12, 2019 21:27
-
-
Save IlyaFinkelshteyn/8f195010434075074bfa4ee48e3fa347 to your computer and use it in GitHub Desktop.
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
$env:API_URL = "https://ci.appveyor.com/api" # replace for AppVeyor Enterprise | |
$env:API_TOKEN = "<replace>" # from https://ci.appveyor.com/api-keys | |
$env:APPVEYOR_ACCOUNT_NAME = "<replace>" # from AppVeyor project URL | |
$env:APPVEYOR_PROJECT_SLUG_OLD = "<replace>" # from AppVeyor project URL | |
$env:APPVEYOR_PROJECT_SLUG_NEW = "<replace>" # Desired slug | |
$headers = @{ | |
"Authorization" = "Bearer $env:API_TOKEN" | |
"Content-type" = "application/json" | |
} | |
$s = Invoke-RestMethod -Uri "$env:API_URL/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG_OLD/settings" -Headers $headers -Method Get | |
$s.settings.slug = $env:APPVEYOR_PROJECT_SLUG_NEW | |
Invoke-RestMethod -Uri "$env:API_URL/projects" -Headers $headers -Body ($s.settings | ConvertTo-Json -Depth 10) -Method Put |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A Python version:
I also put it in a gist https://gist.github.com/dhermes/a4bc8adaf0048c4c69ddb671c61b10b2