Trigger a Build

Matt's Avatar


01 Jun, 2014 10:32 PM

Is there a way to trigger a build via an API call or some other way? I'd like to chain builds.


  1. Support Staff 1 Posted by Feodor Fitsner on 02 Jun, 2014 03:05 AM

    Feodor Fitsner's Avatar

    Hi Matt,

    Yes, you can use API to start a new build. Check this page for code examples calling API:

    To start a new build call the following URL:


    with body:

      "accountName": "<your-account>",
      "projectSlug": "<project-slug-from-URL>",
      "branch": "<optional-branch-name>"
  2. Support Staff 2 Posted by Feodor Fitsner on 02 Jun, 2014 03:07 AM

    Feodor Fitsner's Avatar

    In general, you can use Chrome developer tools or Fiddler to see what's being called on API. AppVeyor UI uses API only.

  3. 3 Posted by scascarini on 04 Jul, 2014 08:50 AM

    scascarini's Avatar

    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 '' -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 '' -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).

  4. Support Staff 4 Posted by Feodor Fitsner on 04 Jul, 2014 09:06 AM

    Feodor Fitsner's Avatar

    The latter is correct - -Body parameter must be an object, not a string (

  5. 5 Posted by scascarini on 04 Jul, 2014 10:03 AM

    scascarini's Avatar

    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 '' -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 '' -Headers $headers -Method Post -Body $body

  6. Support Staff 6 Posted by Feodor Fitsner on 04 Jul, 2014 10:11 AM

    Feodor Fitsner's Avatar

    I see, thanks for your notes.

  7. 7 Posted by Rifat Erdem Sah... on 07 Aug, 2014 02:37 PM

    Rifat Erdem Sahin's Avatar

    Great Topic, Great Feature.

  8. 8 Posted by Rifat Erdem Sah... on 08 Aug, 2014 07:17 AM

    Rifat Erdem Sahin's Avatar

    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 '' -Headers $headers -Method Post -Body $bodyAsjson -ContentType "application/json"

  9. 9 Posted by kerem on 11 Mar, 2015 03:11 PM

    kerem's Avatar


    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?


  10. Support Staff 10 Posted by Feodor Fitsner on 11 Mar, 2015 04:55 PM

    Feodor Fitsner's Avatar

    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. 11 Posted by kerem on 25 Sep, 2015 09:33 PM

    kerem's Avatar

    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?


  12. Support Staff 12 Posted by Feodor Fitsner on 25 Sep, 2015 09:43 PM

    Feodor Fitsner's Avatar

    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:

    This is the "deployment" project downloading artifacts from first project and deploying them with selected method:

    Let me know if you have any questions.

  13. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:00 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? 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