### Serve GoCD API Documentation Locally Source: https://github.com/gocd/api.go.cd/blob/master/README.md Use this command to start a local server for viewing the API documentation on http://localhost:4567. ```bash $ bundle exec middleman serve ``` -------------------------------- ### Install Middleman Dependencies Source: https://github.com/gocd/api.go.cd/blob/master/README.md Run this command to install the necessary dependencies for Middleman. ```bash $ bundle install ``` -------------------------------- ### Build Static Website for GoCD API Docs Source: https://github.com/gocd/api.go.cd/blob/master/README.md Execute this command to generate the static website files for deployment. ```bash $ bundle exec rake build ``` -------------------------------- ### Publish GoCD API Docs to GitHub Pages Source: https://github.com/gocd/api.go.cd/blob/master/README.md Run this command to publish the generated static website to GitHub Pages. ```bash $ bundle exec rake publish ``` -------------------------------- ### GoCD API Reference - Introduction Source: https://github.com/gocd/api.go.cd/blob/master/source/index.html.md This section provides an overview of the GoCD API, including its purpose and general usage guidelines. ```APIDOC ## Introduction to GoCD API This document serves as the official reference for the GoCD API. It details the various endpoints available for interacting with your GoCD server, enabling automation and integration with your CI/CD workflows. ### Key Concepts - **API Versioning**: The API uses versioning to manage changes. The current API version is `application/vnd.go.cd.v1+json`. - **Authentication**: API requests require authentication. Refer to the 'Authentication' section for details on how to authenticate your requests. - **Data Format**: The API primarily uses JSON for request and response bodies. ``` -------------------------------- ### GoCD API Reference - Configuration Repositories Source: https://github.com/gocd/api.go.cd/blob/master/source/index.html.md Endpoints for managing configuration repositories in GoCD. ```APIDOC ## Configuration Repositories API This API allows you to manage configuration repositories, which enable defining your pipelines and environments using version control. ### GET /go/api/admin/config-repos #### Description Retrieves a list of all configured configuration repositories. ### Method GET ### Endpoint /go/api/admin/config-repos ### Parameters None ### Response #### Success Response (200) - **config_repos** (array) - A list of configuration repository objects. - **id** (string) - The unique identifier for the configuration repository. - **material** (object) - Details about the material used for the repository. - **type** (string) - The type of material (e.g., 'git', 'svn'). - **url** (string) - The URL of the repository. - **branch** (string, optional) - The branch to track. - **rules** (object) - Rules for processing the configuration. - **parse_resources** (boolean) - Whether to parse resources. #### Response Example ```json { "config_repos": [ { "id": "my-repo-1", "material": { "type": "git", "url": "https://github.com/example/gocd-config.git", "branch": "main" }, "rules": { "parse_resources": true } } ] } ``` ### POST /go/api/admin/config-repos #### Description Creates a new configuration repository. ### Method POST ### Endpoint /go/api/admin/config-repos ### Parameters #### Request Body - **id** (string) - Required - The unique identifier for the new configuration repository. - **material** (object) - Required - Details about the material. - **type** (string) - Required - The type of material (e.g., 'git', 'svn'). - **url** (string) - Required - The URL of the repository. - **branch** (string, optional) - The branch to track. - **rules** (object) - Optional - Rules for processing the configuration. - **parse_resources** (boolean) - Optional - Whether to parse resources. ### Request Example ```json { "id": "new-repo", "material": { "type": "git", "url": "https://github.com/example/new-config.git", "branch": "develop" }, "rules": { "parse_resources": false } } ``` ### Response #### Success Response (201 Created) - **message** (string) - Confirmation message. #### Response Example ```json { "message": "Configuration repository 'new-repo' created successfully." } ``` ``` -------------------------------- ### Apache License 2.0 Source: https://github.com/gocd/api.go.cd/blob/master/README.md This is the license text for the Apache License, Version 2.0. ```plain Copyright 2008-2013 Concur Technologies, Inc. Copyright 2022 Thoughtworks, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` -------------------------------- ### GoCD API Reference - Authentication Source: https://github.com/gocd/api.go.cd/blob/master/source/index.html.md Details on how to authenticate your API requests to the GoCD server. ```APIDOC ## Authentication To interact with the GoCD API, you need to authenticate your requests. GoCD supports authentication via Personal Access Tokens (PATs) or basic authentication. ### Personal Access Tokens (PATs) 1. Generate a PAT from the GoCD UI under User Profile -> Personal Access Tokens. 2. Include the token in the `Authorization` header of your API requests as a Bearer token: `Authorization: Bearer YOUR_PERSONAL_ACCESS_TOKEN` ### Basic Authentication Alternatively, you can use basic authentication with your GoCD username and password. 1. Encode your username and password in Base64 format: `echo -n 'username:password' | base64` 2. Include the encoded string in the `Authorization` header: `Authorization: Basic ENCODED_USERNAME_PASSWORD` ``` -------------------------------- ### GoCD API Reference - Pipelines Source: https://github.com/gocd/api.go.cd/blob/master/source/index.html.md Endpoints for retrieving information about pipelines. ```APIDOC ## Pipelines API This API provides access to information about pipelines within GoCD. ### GET /go/api/pipelines #### Description Retrieves a list of all pipelines. ### Method GET ### Endpoint /go/api/pipelines ### Parameters None ### Response #### Success Response (200) - **pipelines** (array) - A list of pipeline objects. - **name** (string) - The name of the pipeline. - **group** (string) - The pipeline group it belongs to. - **link** (object) - Link to the pipeline. - **href** (string) - The URL to the pipeline. #### Response Example ```json { "pipelines": [ { "name": "my-pipeline", "group": "production", "link": { "href": "/go/pipelines/my-pipeline" } } ] } ``` ### GET /go/api/pipelines/{pipeline_name} #### Description Retrieves details for a specific pipeline. ### Method GET ### Endpoint /go/api/pipelines/{pipeline_name} ### Parameters #### Path Parameters - **pipeline_name** (string) - Required - The name of the pipeline. ### Response #### Success Response (200) - **name** (string) - The name of the pipeline. - **group** (string) - The pipeline group it belongs to. - **template** (string, optional) - The template used for the pipeline. - **materials** (array) - List of materials associated with the pipeline. - **stages** (array) - List of stages in the pipeline. #### Response Example ```json { "name": "my-pipeline", "group": "production", "template": "my-template", "materials": [ { "type": "git", "url": "https://github.com/example/repo.git", "branch": "main" } ], "stages": [ { "name": "Build", "jobs": [ { "name": "Build Job" } ] } ] } ``` ``` -------------------------------- ### GoCD API Error Codes Source: https://github.com/gocd/api.go.cd/blob/master/source/includes/_errors.md This section details the HTTP status codes returned by the GoCD API for different error scenarios. ```APIDOC ## GoCD API Error Codes ### Description This document outlines the standard HTTP status codes used by the GoCD API to indicate various error conditions. ### Error Codes | Error Code | Meaning | |---|---| | 400 | Bad Request -- The request could not be understood. The client SHOULD NOT repeat the request without modifications. | | 401 | Unauthorized -- Your username or password is incorrect or you are not authorized to perform this action. | | 403 | Forbidden -- The resource requested is hidden for administrators only. | | 404 | Not Found -- The specified resource could not be found. | | 405 | Method Not Allowed -- You tried to access a resource with an invalid method. | | 406 | Not Acceptable -- You requested a format that isn't json. | | 409 | Conflict -- The request could not be completed due to a conflict with the current state of the resource. | | 410 | Gone -- The resource requested has been removed from our servers. | | 412 | Precondition Failed -- The request could not be completed because the state of the resource is not the latest while being updated. | | 422 | Unprocessable Entity -- The server understood the request, but the request is semantically erroneous. | | 500 | Internal Server Error -- We had a problem with our server. Try again later. | | 501 | Not implemented -- The server does not support the functionality required to fulfill the request. | | 503 | Service Unavailable -- We're temporarially offline for maintanance. Please try again later. | ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.