Skip to content
Reference>REST API>/build_deployments

Build Deployments

The /build_deployments endpoint allows you to list and trigger deployments for specific builds. A build deployment executes a deployment definition against the artifacts produced by a build, delivering results to a target environment.

See Also

GET /api/v1/build_deployments — Find Build Deployments

Retrieve a list of build deployments matching the specified filter criteria.

Endpoint

GET https://app.metakraftwerk.com/api/v1/build_deployments

Query Parameters

ParameterTypeRequiredDescription
build_idintegerNoFilter by build ID.
patternstringNoFilter by pattern name.
pattern_idintegerNoFilter by pattern ID.
deploymentstringNoFilter by deployment name.
deployment_idintegerNoFilter by deployment ID.

Response Schema

Returns an array of build deployment objects:

FieldTypeDescription
idintegerUnique build deployment ID.
build_idintegerAssociated build ID.
pattern_idintegerAssociated pattern ID.
deployment_idintegerAssociated deployment definition ID.
upload_idintegerAssociated upload ID.
agent_idintegerAgent ID assigned to execute the deployment.
agent_group_idintegerAgent group ID assigned to execute the deployment.

Examples

cURL

bash
curl -X GET "https://app.metakraftwerk.com/api/v1/build_deployments?build_id=5139" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

JavaScript (Fetch)

javascript
const response = await fetch(
  'https://app.metakraftwerk.com/api/v1/build_deployments?build_id=5139',
  { headers: { 'Authorization': `Bearer ${accessToken}` } }
);

const buildDeployments = await response.json();

Error Responses

StatusConditionExample Message
401Missing or invalid tokenNot authenticated

GET /api/v1/build_deployments/:id — Get Build Deployment

Retrieve a single build deployment by its ID.

Endpoint

GET https://app.metakraftwerk.com/api/v1/build_deployments/:id

Path Parameters

ParameterTypeRequiredDescription
idintegerYesThe build deployment ID.

Examples

cURL

bash
curl -X GET "https://app.metakraftwerk.com/api/v1/build_deployments/1" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

JavaScript (Fetch)

javascript
const response = await fetch(
  'https://app.metakraftwerk.com/api/v1/build_deployments/1',
  { headers: { 'Authorization': `Bearer ${accessToken}` } }
);

const buildDeployment = await response.json();

Error Responses

StatusConditionExample Message
401Missing or invalid tokenNot authenticated
404Build deployment not foundNo record found for id 'X'

POST /api/v1/build_deployments — Create Build Deployment

Trigger a deployment for a specific build. This executes a deployment definition against the build artifacts.

Endpoint

POST https://app.metakraftwerk.com/api/v1/build_deployments

Request Headers

HeaderValue
Content-Typeapplication/json
AuthorizationBearer <ACCESS_TOKEN>

Request Body

FieldTypeRequiredDescription
build_idintegerYesThe build ID to deploy.
patternstringYes*Pattern name. Mutually exclusive with pattern_id.
pattern_idintegerYes*Pattern ID. Mutually exclusive with pattern.
deploymentstringYesDeployment name. Mutually exclusive with deployment_id.
deployment_idintegerYesDeployment ID. Mutually exclusive with deployment.
agentstringNo‡Agent name to execute the deployment.
agent_idintegerNo‡Agent ID to execute the deployment.
agent_groupstringNo‡Agent group name. Any available agent in the group will execute the deployment.
agent_group_idintegerNo‡Agent group ID.

TIP

* Exactly one of pattern or pattern_id is required.

† Exactly one of deployment or deployment_id is required.

‡ Specify either a specific agent (agent/agent_id) or an agent group (agent_group/agent_group_id), or neither to use the default assignment.

Examples

cURL

bash
curl -X POST "https://app.metakraftwerk.com/api/v1/build_deployments" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "build_id": 5139,
    "pattern": "CORE_DV_HLS",
    "deployment": "DEPLOY_TO_DEV",
    "agent_group": "DEV_AGENTS"
  }'

JavaScript (Fetch)

javascript
const response = await fetch('https://app.metakraftwerk.com/api/v1/build_deployments', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    build_id: 5139,
    pattern: 'CORE_DV_HLS',
    deployment: 'DEPLOY_TO_DEV',
    agent_group: 'DEV_AGENTS'
  })
});

const result = await response.json();

Error Responses

StatusConditionExample Message
400Missing required fieldsA build_id is required!
401Missing or invalid tokenNot authenticated
404Build not foundBuild not found
404Deployment not foundA deployment with the name 'X' does not exist!

PUT /api/v1/build_deployments — Update

Not implemented

PATCH /api/v1/build_deployments/:id — Patch

Not implemented

DELETE /api/v1/build_deployments/:id — Remove

Not implemented