Trigger a Build
Is there a way to trigger a build via an API call or some other way? I'd like to chain builds.
Thanks,
Matt
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Feodor Fitsner on Jun 02, 2014 @ 03:05 AM
Hi Matt,
Yes, you can use API to start a new build. Check this page for code examples calling API: http://www.appveyor.com/docs/api
To start a new build call the following URL:
with body:
Support Staff 2 Posted by Feodor Fitsner on Jun 02, 2014 @ 03:07 AM
In general, you can use Chrome developer tools or Fiddler to see what's being called on API. AppVeyor UI uses API only.
3 Posted by scascarini on Jul 04, 2014 @ 08:50 AM
I've been strugging getting this working
I have in powershell
`$token = 'token'
$headers = @{ "Authorization" = "Bearer $token"}
$body = @{accountName = "accountName"; projectSlug = "pslug"}
$bodyAsJson = $body | ConvertTo-json`
Invoke-Restmethod -uri 'https://ci.appveyor.com/api/builds' -Headers $headers -Method Post -Body $bodyAsJson
And I get back
{"message":"Project not found or access denied."}
However by accident I entered
Invoke-Restmethod -uri 'https://ci.appveyor.com/api/builds' -Headers $headers -Method Post -Body $body
(ie with a non-json body) and this worked and successfully triggered a build!
Is there a bug here or am I doing something else wrong ? (Although I'm happy to have triggered the build).
Support Staff 4 Posted by Feodor Fitsner on Jul 04, 2014 @ 09:06 AM
The latter is correct -
-Body
parameter must be an object, not a string (http://technet.microsoft.com/en-us/library/hh849971.aspx).5 Posted by scascarini on Jul 04, 2014 @ 10:03 AM
Invoke-Restmethod happily sends the body as Json (checked with Fiddler). My query was really that I read your comment (#2) above as the body having to be json rather than name value pairs.
On reflection I tried setting the content type correctly (!)
Invoke-Restmethod -uri 'https://ci.appveyor.com/api/builds' -Headers $headers -Method Post -Body $bodyAsjson -ContentType "application/json"
and that works. So that's all good.
If I leave the Content Type as the default (application/x-www-form-urlencoded) it also works with name value pairs
Invoke-Restmethod -uri 'https://ci.appveyor.com/api/builds' -Headers $headers -Method Post -Body $body
Support Staff 6 Posted by Feodor Fitsner on Jul 04, 2014 @ 10:11 AM
I see, thanks for your notes.
7 Posted by Rifat Erdem Sah... on Aug 07, 2014 @ 02:37 PM
Great Topic, Great Feature.
8 Posted by Rifat Erdem Sah... on Aug 08, 2014 @ 07:17 AM
Script to copy paste
****************************************************************************
$token = 'write_your_token_here'
$headers = @{ "Authorization" = "Bearer $token"}
$body = @{accountName = "write_your_account_name"; projectSlug = "write_your_project_name"}
$bodyAsJson = $body | ConvertTo-json
Invoke-Restmethod -uri 'https://ci.appveyor.com/api/builds' -Headers $headers -Method Post -Body $bodyAsjson -ContentType "application/json"
****************************************************************************
9 Posted by kerem on Mar 11, 2015 @ 03:11 PM
Hello,
We want to run our acceptance test project after deployment completes. While AWS Elasticbeanstalk needs 3-5 minutes to propagate the deployment.
Is it possible to postpone trigger to run X minutes after initial build completes?
Thanks,
Kerem
Support Staff 10 Posted by Feodor Fitsner on Mar 11, 2015 @ 04:55 PM
There is no such ability right now. You could develop some kind of "buffering" service with delay inside or using Service Bus - just few ideas.
11 Posted by kerem on Sep 25, 2015 @ 09:33 PM
Hello Feodor,
I'm trying to trigger another project to make deployment to aws elastic beanstalk. I have the scripts ready but cannot post proper parameters and catch from the project I triggered.
I need path to two of the artifacts to be post and referenced from other project. Can you help me with the ps script?
Thanks,
Kerem
Support Staff 12 Posted by Feodor Fitsner on Sep 25, 2015 @ 09:43 PM
Here you are. We've added some helper methods to call other project builds and download artifacts.
This is how to start a new build of another "deployment" project: https://github.com/appveyor/simple-web/blob/master/appveyor.yml#L20...
This is the "deployment" project downloading artifacts from first project and deploying them with selected method: https://github.com/FeodorFitsner/deploy-project/blob/master/appveyo...
Let me know if you have any questions.
Ilya Finkelshteyn closed this discussion on Aug 25, 2018 @ 02:00 AM.