Docs Navigation

Api v2 Configuration Files

Stability: prototype

  1. List config files connected to a project
  2. List config files belonging to a shared configuration
  3. Get a config file
  4. Create a config file within a shared configuration
  5. Update a config file
  6. Delete a config file
  7. Connect a shared config file to a project
  8. Disconnect a shared config file from a project

List config files connected to a project

GET /projects/{project_id}/config_files
Response
HTTP status: 200

[
  {
    "id": "86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
    "path": ".credentials",
    "url": "https://api.semaphoreci.com/v2/config_files/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
    "content": "password: ec2c9f6f64b5",
    "shared": true,
    "encrypted": false,
    "created_at": "2017-06-10 16:59:51 +0200",
    "updated_at": "2017-06-10 16:59:51 +0200"
  }
]

List config files belonging to a shared configuration

GET /shared_configs/{shared_config_id}/config_files
Response
HTTP status: 200

[
  {
    "id": "86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
    "path": ".credentials",
    "url": "https://api.semaphoreci.com/v2/config_files/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
    "content": "password: ec2c9f6f64b5",
    "shared": true,
    "encrypted": false,
    "created_at": "2017-06-10 16:59:51 +0200",
    "updated_at": "2017-06-10 16:59:51 +0200"
  }
]

Get a config file

Displays the configuration file. Encrypted configuration files will have null as content.

GET /config_files/{id}
Response
HTTP status: 200

{
  "id": "86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
  "path": ".credentials",
  "url": "https://api.semaphoreci.com/v2/config_files/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
  "content": "password: ec2c9f6f64b5",
  "shared": true,
  "encrypted": false,
  "created_at": "2017-06-10 16:59:51 +0200",
  "updated_at": "2017-06-10 16:59:51 +0200"
}

Create a config file within a shared configuration

Configuration files can be only created by users who can edit the shared configuration.

POST /shared_configs/{shared_config_id}/config_files
Request
Name Type Description
path string Required. Path of the configuration file.
content string Required. Content of the configuration file. Will be null if the file is encrypted.
encrypted boolean Required. True if the file is encrypted.
Response
HTTP status: 200

{
  "id": "86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
  "path": ".credentials",
  "url": "https://api.semaphoreci.com/v2/config_files/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
  "content": "password: ec2c9f6f64b5",
  "shared": true,
  "encrypted": false,
  "created_at": "2017-06-10 16:59:51 +0200",
  "updated_at": "2017-06-10 16:59:51 +0200"
}

Update a config file

Configuration files can be only updated by users who has edit access on the project or the shared configuration. Encrypted environment variables can't be edited.

PATCH /config_files/{id}
Request
Name Type Description
path string Path of the configuration file.
content string Content of the configuration file.
Response
HTTP status: 200

{
  "id": "86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
  "path": ".credentials",
  "url": "https://api.semaphoreci.com/v2/config_files/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
  "content": "password: ec2c9f6f64b5",
  "shared": true,
  "encrypted": false,
  "created_at": "2017-06-10 16:59:51 +0200",
  "updated_at": "2017-06-10 16:59:51 +0200"
}

Delete a config file

Configuration files can be only deleted by users who has edit access on the project or the shared configuration.

DELETE /config_files/{id}
Response
HTTP status: 204

Connect a shared config file to a project

POST /projects/{project_id}/config_files/{config_file_id}
Response
HTTP status: 204

Disconnect a shared config file from a project

DELETE /projects/{project_id}/config_files/{config_file_id}
Response
HTTP status: 204

Semaphore Docs are open source — Edit on GitHub

Newsletter

Occasional lightweight product and blog updates. Unsubscribe at any time.

2009-2017 © Rendered Text. All rights reserved. Terms of Service, Privacy policy, Security.