<< Back to GForge REST API

Entity: Build

GET

getBuild

For the moment this method supports getting a build by id or a set of builds by job id or project id. At the moment only one of these options will be used at a time.

Parameters (3)

Name Type Description
id int The database ID of a specific build to be retrieved. If specified, then any other filter values will be ignored and the call will return zero or one record.
jobId int Database ID for a job, and will return all builds associatted with the job. This param has the second highest priority behind id.
project mixed Database ID for a project or the project's unix name, and will return all builds associated with the project. This param has the lowest priority.
Sortable
Use the sort_field and sort_dir parameters to control the order in which records are returned.
Pageable
Use the page_size and page_num parameters to control the set of records returned.

Return: \gforge\plugins\build\models\api\BuildBasic

Zero or more BuildBasic records for a search. Zero or one BuildBasic record for an id retrieval.

Name Type Description
id int Unique database identifier for the build
description string description of this build
changelog string Changes made from the previous build
url string url to this build
job mixed the associated Job
wasSuccessful bool Whether this build was successful or not
buildDate \DateTime The date of the last message posting in this forum, across all threads (read-only)
buildNumber int Identifier for the build instance, provided by the build engine.

Example 1

Get the build with id 1:
  GET http://api.mygforge.tld/build/140

 {
     "id":140,
     "description":"test",
     "changelog":"committer example  [#12345]",
     "url":"builds.example.com/test/15",
     "job":140,
     "wasSuccessful":true,
     "buildDate":{"date":"2016-09-12 15:58:49","timezone_type":1,"timezone":"-05:00"}
 }

Example 2

Find builds that are associated with job 1:
  GET http://api.mygforge.tld/build/?jobId=1

{"paging":
 {
     "page_size":20,
     "page_num":1,
     "sort_field":"id",
     "sort_dir":"asc"
 },
 "items":
     [
         {
             "id":1,
             "description":"example",
             "changelog":"committer example  [#12345]",
             "url":"builds.example.com/example/1",
             "job":115,
             "wasSuccessful":true,
             "buildDate":{"date":"2013-02-14 13:06:29","timezone_type":1,"timezone":"-06:00"}
         },
         {
             "id":96,
             "description":"Another example",
             "changelog":"committer example  [#12345]",
             "url":"builds.example.com/example/2",
             "job":115,
             "wasSuccessful":true,
             "buildDate":{"date":"2016-08-03 09:23:33","timezone_type":1,"timezone":"-05:00"}
         },
     ],
 "links":[]
 }
 

Example 3

Find builds associated with project gforge5:
  GET http://api.mygforge.tld/build/?projId=gforge5

{"paging":
 {
     "page_size":20,
     "page_num":1,
     "sort_field":"id",
     "sort_dir":"asc"
 },
 "items":
     [
         {
             "id":1,
             "description":"example",
             "changelog":"committer example  [#12345]",
             "url":"builds.example.com/example/1",
             "job":115,
             "wasSuccessful":true,
             "buildDate":{"date":"2013-02-14 13:06:29","timezone_type":1,"timezone":"-06:00"}
         },
         {
             "id":96,
             "description":"Another example",
             "changelog":"committer example  [#12345]",
             "url":"builds.example.com/example/2",
             "job":115,
             "wasSuccessful":true,
             "buildDate":{"date":"2016-08-03 09:23:33","timezone_type":1,"timezone":"-05:00"}
         },
         {
             "id":140,
             "description":"test",
             "changelog":"committer example  [#12345]",
             "url":"builds.example.com/test/15",
             "job":140,
             "wasSuccessful":true,
             "buildDate":{"date":"2016-09-12 15:58:49","timezone_type":1,"timezone":"-05:00"}
         }
     ],
 "links":[]
 }
 

POST

postBuild

Create a new build and an associated job if necessary

Parameters (9)

Name Type Description
jobName string Name of the job. Required
jobUrl string URL to the job. Required
jobDescription string Description of the job, used only if the job is new. Required
project string unix name or id of related project. Required
buildResult string Result of the build. Required
buildOutput string Output from the build Required
buildUrl string URL to the build Required
buildNumber string Unique identifier for this instance of the build, as defined by the build provider.
changelog string URL to the build Required

Return: (none)

PUT

DELETE