Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
$token = '<API_TOKEN>' # account-level API token
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
# create new project
$body = @{
$body = $body | ConvertTo-Json
#use '<appveyor_account_name>/projects' endpount is using v2 'all accounts' API token
$newProject = Invoke-RestMethod -Uri '' -Headers $headers -Body $body -Method POST
# read existing project config
# note: by default <appveyor_account_name> is the same as <githib_user_name> and <appveyor_project_name> is the same as <github_repo_name>
$s = Invoke-RestMethod -Uri '<appveyor_account_name>/<appveyor_project_name>/settings' -Headers $headers -Method Get
# update config with new project data
$s.settings.projectId = $newProject.projectId
$s.settings.slug = ($s.settings.slug + "-new")
# optionally update project name
$ = ($ + "-new")
#update new project
Invoke-RestMethod -Uri '' -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