Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$token = '<API_Token>'
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}
$body = @{
accountName="<Your_account>"
projectSlug="<Your_project_slug>"
branch="<Your_branch>"
commitId="<Your_commit_id>"
}
$body = $body | ConvertTo-Json
Invoke-RestMethod -Uri 'https://ci.appveyor.com/api/builds' -Headers $headers -Body $body -Method POST
@MingweiSamuel
Copy link

MingweiSamuel commented Oct 15, 2019

Here is a script your can run in your browser's javascript terminal, so you don't need to bother with auth (run on project's page)

var [, , accountName, projectSlug] = document.location.pathname.split('/');
fetch(`https://ci.appveyor.com/api/account/${accountName}/builds`,
{
	method: "POST",
	headers: {
		'Content-Type': 'application/json',
	},
	body: JSON.stringify({
		accountName,
		projectSlug,
		// from commit
		commitId: 'aa03f23db584039251006b9df9646a19c907bff8', // CHANGE ME
		branch: 'master', // CHANGE ME
		// // or from PR
		// pullRequestId: 3,
		// // env vars
		// "environmentVariables": {
		//	"my_var": "value",
		//	"another_var": "another value"
		// }
	}),
});

@andymac4182
Copy link

andymac4182 commented Sep 27, 2020

Wow. I really hope they could even add this script as a button on the page... Seems fairly simple

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