Update project

4 minute read

PUT /organizations/{organization_uuid}/projects/{uuid}

Updates an existing project. Note that setup_commands and environment_variables are only accepted for type basic.

Also note that updating a project will replace all previous information on the project. You’re effectively overwriting the existing project with a new one, so make sure to get the existing values using the Get Project endpoint.

When updating notifications for a project, the following option attributes should be included depending on the notifier:

  • Slack: key

  • Webhook: url

  • Campfire: url, key, room

  • Flowdock: key

When defining a branch filter, a branch match can be a full branch name like main, or a regular expression like ^features.*$. Remember to start a regular expression with ^ and end it with $.

To update test or deployment pipelines, use the respective endpoints.

Authentication

  • OAuth2

OAuth2 scopes

  • project.write

Path parameters

Field name Type Required

organization_uuid

string

X

uuid

string

X

Headers

Field name Type Required

Authorization

string

X

Request body schema

  • Content type: application/json

  • Response schema type: object

Field name Type Required

type

string Allowed values: basic, pro

X

setup_commands

array[string]

team_ids

array[number]

notification_rules

array[object]

  • notifier

string Allowed values: email, slack, campfire, flowdock, webhook

  • email_target

string Allowed values: all, committer

  • branch

string

  • options

object

slack

object

key

string

webhook

object

url

string

campfire

object

key

string

room

string

domain

string

flowdock

object

key

string

environment_variables

array[object]

  • name

string

  • value

string

build_on_pr_only

boolean

branch_match

string Allowed values: include, exclude

branches

array[string]

Responses

Code Datatype

200

Response schema

401

Error

403

Error

404

Error

500

Error

Response schema

  • Content type: application/json

  • Response schema type: object

Field name Type

aes_key

string

uuid

string

organization_uuid

string

authentication_user

string

name

string

repository_provider

string

ssh_key

string

repository_url

string

type

string Allowed values: basic, pro

created_at

string

updated_at

string

build_on_pr_only

boolean

branch_match

string Allowed values: include, exclude

branches

array[string]

setup_commands

array[string]

test_pipelines

array[object]

  • id

integer

  • name

string

  • commands

array[string]

team_ids

array[number]

notification_rules

array[object]

  • notifier

string Allowed values: email, slack, campfire, flowdock, webhook

  • target

string Allowed values: all, committer

  • branch

string

  • options

object

key

string

url

string

room

string

  • build_statuses

array[string] Allowed values: started, failed, success, recovered

  • branch_match

string Allowed values: exact, regex, wildcard

environment_variables

array[object]

  • name

string

  • value

string

deployment_pipelines

array[object]

  • id

integer

  • branch

object

branch_name

string

match_mode

string

  • config

object

  • position

integer

Code examples

cURL
Go
Java
Node
PHP
Python
Ruby
C#
curl --request PUT \
  --url https://api.codeship.com/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161 \
  --header 'authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9' \
  --header 'content-type: application/json' \
  --data '{"type":"string (required)","setup_commands":["string"],"team_ids":["number"],"notification_rules":[{"notifier":"string (optional)","email_target":"string (optional)","branch":"string (optional)","options":{"slack":{"key":"string (optional)"},"webhook":{"url":"string (optional)"},"hipchat":{"key":"string (optional)","room":"string (optional)"},"campfire":{"key":"string (optional)","room":"string (optional)","domain":"string (optional)"},"grove":{"key":"string (optional)"},"flowdock":{"key":"string (optional)"}}}],"environment_variables":[{"name":"string (optional)","value":"string (optional)"}],"build_on_pr_only":"boolean (optional)","branches":["string"],"branch_match":"string (optional)"}'
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"

	payload := strings.NewReader("{\"type\":\"string (required)\",\"setup_commands\":[\"string\"],\"team_ids\":[\"number\"],\"notification_rules\":[{\"notifier\":\"string (optional)\",\"email_target\":\"string (optional)\",\"branch\":\"string (optional)\",\"options\":{\"slack\":{\"key\":\"string (optional)\"},\"webhook\":{\"url\":\"string (optional)\"},\"hipchat\":{\"key\":\"string (optional)\",\"room\":\"string (optional)\"},\"campfire\":{\"key\":\"string (optional)\",\"room\":\"string (optional)\",\"domain\":\"string (optional)\"},\"grove\":{\"key\":\"string (optional)\"},\"flowdock\":{\"key\":\"string (optional)\"}}}],\"environment_variables\":[{\"name\":\"string (optional)\",\"value\":\"string (optional)\"}],\"build_on_pr_only\":\"boolean (optional)\",\"branches\":[\"string\"],\"branch_match\":\"string (optional)\"}")

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

	req.Header.Add("authorization", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9")
	req.Header.Add("content-type", "application/json")

	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/json");
RequestBody body = RequestBody.create(mediaType, "{\"type\":\"string (required)\",\"setup_commands\":[\"string\"],\"team_ids\":[\"number\"],\"notification_rules\":[{\"notifier\":\"string (optional)\",\"email_target\":\"string (optional)\",\"branch\":\"string (optional)\",\"options\":{\"slack\":{\"key\":\"string (optional)\"},\"webhook\":{\"url\":\"string (optional)\"},\"hipchat\":{\"key\":\"string (optional)\",\"room\":\"string (optional)\"},\"campfire\":{\"key\":\"string (optional)\",\"room\":\"string (optional)\",\"domain\":\"string (optional)\"},\"grove\":{\"key\":\"string (optional)\"},\"flowdock\":{\"key\":\"string (optional)\"}}}],\"environment_variables\":[{\"name\":\"string (optional)\",\"value\":\"string (optional)\"}],\"build_on_pr_only\":\"boolean (optional)\",\"branches\":[\"string\"],\"branch_match\":\"string (optional)\"}");
Request request = new Request.Builder()
  .url("https://api.codeship.com/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161")
  .put(body)
  .addHeader("authorization", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9")
  .addHeader("content-type", "application/json")
  .build();

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

var options = {
  "method": "PUT",
  "hostname": "api.codeship.com",
  "port": null,
  "path": "/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161",
  "headers": {
    "authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
    "content-type": "application/json"
  }
};

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(JSON.stringify({ type: 'string (required)',
  setup_commands: [ 'string' ],
  team_ids: [ 'number' ],
  notification_rules:
   [ { notifier: 'string (optional)',
       email_target: 'string (optional)',
       branch: 'string (optional)',
       options:
        { slack: { key: 'string (optional)' },
          webhook: { url: 'string (optional)' },
          hipchat: { key: 'string (optional)', room: 'string (optional)' },
          campfire:
           { key: 'string (optional)',
             room: 'string (optional)',
             domain: 'string (optional)' },
          grove: { key: 'string (optional)' },
          flowdock: { key: 'string (optional)' } } } ],
  environment_variables: [ { name: 'string (optional)', value: 'string (optional)' } ],
  build_on_pr_only: 'boolean (optional)',
  branches: [ 'string' ],
  branch_match: 'string (optional)' }));
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",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "{\"type\":\"string (required)\",\"setup_commands\":[\"string\"],\"team_ids\":[\"number\"],\"notification_rules\":[{\"notifier\":\"string (optional)\",\"email_target\":\"string (optional)\",\"branch\":\"string (optional)\",\"options\":{\"slack\":{\"key\":\"string (optional)\"},\"webhook\":{\"url\":\"string (optional)\"},\"hipchat\":{\"key\":\"string (optional)\",\"room\":\"string (optional)\"},\"campfire\":{\"key\":\"string (optional)\",\"room\":\"string (optional)\",\"domain\":\"string (optional)\"},\"grove\":{\"key\":\"string (optional)\"},\"flowdock\":{\"key\":\"string (optional)\"}}}],\"environment_variables\":[{\"name\":\"string (optional)\",\"value\":\"string (optional)\"}],\"build_on_pr_only\":\"boolean (optional)\",\"branches\":[\"string\"],\"branch_match\":\"string (optional)\"}",
  CURLOPT_HTTPHEADER => array(
    "authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
    "content-type: application/json"
  ),
));

$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 = "{\"type\":\"string (required)\",\"setup_commands\":[\"string\"],\"team_ids\":[\"number\"],\"notification_rules\":[{\"notifier\":\"string (optional)\",\"email_target\":\"string (optional)\",\"branch\":\"string (optional)\",\"options\":{\"slack\":{\"key\":\"string (optional)\"},\"webhook\":{\"url\":\"string (optional)\"},\"hipchat\":{\"key\":\"string (optional)\",\"room\":\"string (optional)\"},\"campfire\":{\"key\":\"string (optional)\",\"room\":\"string (optional)\",\"domain\":\"string (optional)\"},\"grove\":{\"key\":\"string (optional)\"},\"flowdock\":{\"key\":\"string (optional)\"}}}],\"environment_variables\":[{\"name\":\"string (optional)\",\"value\":\"string (optional)\"}],\"build_on_pr_only\":\"boolean (optional)\",\"branches\":[\"string\"],\"branch_match\":\"string (optional)\"}"

headers = {
    'authorization': "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
    'content-type': "application/json"
    }

conn.request("PUT", "/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161", 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")

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

request = Net::HTTP::Put.new(url)
request["authorization"] = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9'
request["content-type"] = 'application/json'
request.body = "{\"type\":\"string (required)\",\"setup_commands\":[\"string\"],\"team_ids\":[\"number\"],\"notification_rules\":[{\"notifier\":\"string (optional)\",\"email_target\":\"string (optional)\",\"branch\":\"string (optional)\",\"options\":{\"slack\":{\"key\":\"string (optional)\"},\"webhook\":{\"url\":\"string (optional)\"},\"hipchat\":{\"key\":\"string (optional)\",\"room\":\"string (optional)\"},\"campfire\":{\"key\":\"string (optional)\",\"room\":\"string (optional)\",\"domain\":\"string (optional)\"},\"grove\":{\"key\":\"string (optional)\"},\"flowdock\":{\"key\":\"string (optional)\"}}}],\"environment_variables\":[{\"name\":\"string (optional)\",\"value\":\"string (optional)\"}],\"build_on_pr_only\":\"boolean (optional)\",\"branches\":[\"string\"],\"branch_match\":\"string (optional)\"}"

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");
var request = new RestRequest(Method.PUT);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9");
request.AddParameter("application/json", "{\"type\":\"string (required)\",\"setup_commands\":[\"string\"],\"team_ids\":[\"number\"],\"notification_rules\":[{\"notifier\":\"string (optional)\",\"email_target\":\"string (optional)\",\"branch\":\"string (optional)\",\"options\":{\"slack\":{\"key\":\"string (optional)\"},\"webhook\":{\"url\":\"string (optional)\"},\"hipchat\":{\"key\":\"string (optional)\",\"room\":\"string (optional)\"},\"campfire\":{\"key\":\"string (optional)\",\"room\":\"string (optional)\",\"domain\":\"string (optional)\"},\"grove\":{\"key\":\"string (optional)\"},\"flowdock\":{\"key\":\"string (optional)\"}}}],\"environment_variables\":[{\"name\":\"string (optional)\",\"value\":\"string (optional)\"}],\"build_on_pr_only\":\"boolean (optional)\",\"branches\":[\"string\"],\"branch_match\":\"string (optional)\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);