Trigger a new build without committing new code to your Git

Wercker is a company that enables development teams to achieve their CI/CD goals with microservices and Docker.

Toon Verbeek
Toon Verbeek
June 24, 2015

Last month we announced our new API. Today we’re excited to release a new endpoint: triggerBuild!


wercker new api

 

With this endpoint, you will now be able to trigger a new build on your application without first committing new code to your Git provider.

This allows for a variety of new usecases, like triggering a new build on another application from your application’s step (effectively allowing you to chain builds!) or simply rebuilding a build that was successful, a much requested feature.

Below you will find an example request and response to help you understand the new endpoint.

Example

POST /api/v3/builds

Request

$ curl  -H 'Content-Type: application/json' -H  'Authorization: Bearer <token>' -X POST -d '{"applicationId": "<applicationId>", "branch":"master", "commitHash":"<commitId>", "message":"<your custom message>"}' https://app.wercker.com/api/v3/builds

Response

{
  "id": "557591da3f1aefa778000009",
  "url": "http://172.17.8.99/api/v3/builds/557591da3f1aefa778000009",
  "application": {
    "id": "54c9168980c7075225004157",
    "url": "https://app.wercker.com/api/v3/applications/wercker/docs",
    "name": "docs",
    "owner": {
      "type": "wercker",
      "name": "wercker",
      "avatar": {
        "gravatar": "33a5bfbcf8a2b90f40e849b6f1fa5eeb"
      },
      "userId": "55310d295732ce8a41000054",
      "meta": {
        "username": "wercker",
        "werckerEmployee": false
      }
    },
    "createdAt": "2015-06-08T12:47:39.819Z",
    "privacy": "private",
    "stack": 5
  },
  "branch": "master",
  "createdAt": "2015-06-08T13:00:10.180Z",
  "message": "Fixed OAuth error",
  "progress": null,
  "result": "unknown",
  "status": "notstarted"
}

To use our API be sure you set up a token first so you don’t run into authentication issues. You can read more about our API in the devcenter.

Applications endpoint changes

We’ve updated the way the get applications endpoint work. It will now give paged results. The default number of applications returned is 20. You can manages the default and offset by using the skip and limit querstring parameters.

It is now also possible to change the sorting key of the result. By default it will use the name of the application, but it is also possible to use the creation date or update date.

Providing feedback

Running into an issue, need a certain property, or need access to a particular resource? Let us know through an issue in the wercker/api repository.

Earn some stickers!

We’re looking forward to hearing your feebdack and seeing what you will build with the new API! Don’t forget to tweet out your first green build with #wercker and we’ll send you some @wercker stickers!

 

Topics: Product, Containers