List builds

2 minute read

GET /organizations/{organization_uuid}/projects/{project_uuid}/builds

Authentication

  • OAuth2

OAuth2 scopes

  • build.read

Path parameters

Field name Type Required

organization_uuid

string

X

project_uuid

string

X

Headers

Field name Type Required

Authorization

string

X

Query string

Field name Type Required

per_page

number

page

number

Responses

Code Datatype

200

Response schema

401

Error

403

Error

404

Error

500

Error

Response schema

  • Content type: application/json

  • Response schema type: array[object]

Field name Type

project_uuid

string

commit_message

string

status

string

branch

string

uuid

string

queued_at

string

username

string

ref

string

commit_sha

string

finished_at

string

allocated_at

string

organization_uuid

string

links

object

  • steps

string

  • services

string

  • pipelines

string

Response example

{
  "builds": [
    {
      "uuid": "20b4a690-6a03-0135-d6ec-000000000000",
      "project_uuid": "7b3596c0-560e-0135-5b18-000000000000",
      "organization_uuid": "721cea10-b695-0134-5b94-000000000000",
      "ref": "heads/master",
      "commit_sha": "575a1521fff1466c3ed9fae9d390e0ffffffffff",
      "status": "failed",
      "username": "codeship-bot",
      "commit_message": "Triggering failed build",
      "finished_at": "2017-12-07T22:17:51.280Z",
      "allocated_at": null,
      "queued_at": "2017-12-07T22:16:56.670Z",
      "links": {
        "pipelines": "https://api.codeship.com/v2/organizations/721cea10-b695-0134-5b94-000000000000/projects/7b3596c0-560e-0135-5b18-000000000000/builds/20b4a690-6a03-0135-d6ec-000000000000/pipelines"
      }
    },
    {
      "uuid": "fc67c7b0-5911-0135-7f99-000000000000",
      "project_uuid": "7b3596c0-560e-0135-5b18-000000000000",
      "organization_uuid": "721cea10-b695-0134-5b94-000000000000",
      "ref": "heads/master",
      "commit_sha": "119bef0f9bd1421b9e2fbf9b05f760ffffffffff",
      "status": "success",
      "username": "codeship-bot",
      "commit_message": "Update to API documentation",
      "finished_at": "2017-08-23T07:26:01.877Z",
      "allocated_at": null,
      "queued_at": "2017-08-23T07:24:41.327Z",
      "links": {
        "pipelines": "https://api.codeship.com/v2/organizations/721cea10-b695-0134-5b94-000000000000/projects/7b3596c0-560e-0135-5b18-000000000000/builds/fc67c7b0-5911-0135-7f99-000000000000/pipelines"
      }
    }
  ],
  "total": 2,
  "per_page": 30,
  "page": 1
}

Code examples

cURL
Go
Java
Node
PHP
Python
Ruby
C#
curl --request GET \
  --url 'https://api.codeship.com/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/builds?page=1&per_page=3' \
  --header 'authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9' \
  --data '{}'
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.codeship.com/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/builds?page=1&per_page=3"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("GET", url, payload)

	req.Header.Add("authorization", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/octet-stream");
RequestBody body = RequestBody.create(mediaType, "{}");
Request request = new Request.Builder()
  .url("https://api.codeship.com/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/builds?page=1&per_page=3")
  .get()
  .addHeader("authorization", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "api.codeship.com",
  "port": null,
  "path": "/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/builds?page=1&per_page=3",
  "headers": {
    "authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write("{}");
req.end();
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.codeship.com/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/builds?page=1&per_page=3",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "{}",
  CURLOPT_HTTPHEADER => array(
    "authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.codeship.com")

payload = "{}"

headers = { 'authorization': "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9" }

conn.request("GET", "/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/builds?page=1&per_page=3", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.codeship.com/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/builds?page=1&per_page=3")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9'
request.body = "{}"

response = http.request(request)
puts response.read_body
var client = new RestClient("https://api.codeship.com/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/builds?page=1&per_page=3");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9");
request.AddParameter("undefined", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);