Skip to main content

Handle lifecycle via API

You can manage a project's releases and deployments from a script or a CI/CD pipeline using the Builder API. This guide walks through creating or updating a draft, reviewing its descriptor, deploying it, and promoting it when it is ready. For the concepts behind these steps, see the release lifecycle overview.

These are separate operations: creating or updating a draft does not deploy it, deploying a draft does not promote it, and promoting a draft does not deploy the resulting release. For the complete request and response schemas, see the Builder API reference.

Before you begin​

You need:

  • The URL of your Witboost instance and the project's System URN, for example urn:dmb:dp:finance:orders:0.
  • A target environment, such as dev, configured in your instance.
  • An authenticated user or service account with access to the project and the permissions required for the actions you perform. Descriptor and provisioning requests also require access to the target environment.
  • A short-lived JWT for the examples below. See API authentication for how to obtain one and for service-account guidance.
  • curl 7.83.0 or later to run the examples.

Set these variables in your shell, replacing the example values. Obtain WITBOOST_JWT through your usual secure authentication flow; do not commit it to source control or expose it in CI logs.

export WITBOOST_URL="https://your-witboost-instance.example"
export PROJECT_URN="urn:dmb:dp:finance:orders:0"
export ENVIRONMENT="dev"
export API="${WITBOOST_URL}/api/builder/v1"

The examples assume $WITBOOST_JWT is already set. They use a simple environment name; URL-encode path and query values when needed. Run each step only after the previous operation has succeeded.

1. Check for an active draft​

A project can have one active draft. Retrieve it to decide whether to create a draft or update the existing one:

curl -sS -i \
-H "Authorization: Bearer ${WITBOOST_JWT}" \
"${API}/projects/${PROJECT_URN}/releases/draft"

A 200 response contains the draft's version and state. A 404 from this active-draft lookup means there is no active draft; create one in the next step. Handle authentication, authorization, and other errors separately rather than treating them as a missing draft.

To browse existing releases, use the following request. Results are ordered by creation time, newest first. When meta.pagination.hasMore is true, pass meta.pagination.nextCursor as cursor with the same limit to retrieve the next page.

curl -sS \
-H "Authorization: Bearer ${WITBOOST_JWT}" \
"${API}/projects/${PROJECT_URN}/releases?limit=20"

2. Create or update the draft​

If no draft exists, create one with POST. If there is already an active draft, use PUT on the same URL instead. The example selects a branch for the project; replace the URN and branch with your own. Add component URNs to branches when you need to choose their sources too. Set refType to tag to use a tag; it defaults to branch when omitted. If a selection or the entire body is omitted, the configured source branch is used for that entity.

curl -sS -X POST \
-H "Authorization: Bearer ${WITBOOST_JWT}" \
-H "Content-Type: application/json" \
-d '{"branches":[{"urn":"urn:dmb:dp:finance:orders:0","branch":"main"}]}' \
"${API}/projects/${PROJECT_URN}/releases/draft"

The response is 202 Accepted with an operationId, not the completed draft. Copy that ID into the variable below and wait for the operation before using its resulting version. A 409 can mean the draft already exists, no draft is available for update, or another release mutation is in progress; inspect the response and project state before retrying.

export RELEASE_OPERATION_ID="<operationId from the response>"

3. Wait for the release operation​

Use the operation ID to check progress:

curl -sS \
-H "Authorization: Bearer ${WITBOOST_JWT}" \
"${API}/release-operations/${RELEASE_OPERATION_ID}/status"

Repeat the request while status is running. When it is succeeded, result.version is the version to use in the following steps. If it is failed, inspect the returned error and stop the workflow. Repository changes may already have occurred, so check the draft and release list before retrying.

Alternatively, follow the same status updates as a Server-Sent Events stream. The stream closes at a terminal state; disconnecting does not cancel the operation.

curl -sS -N \
-H "Authorization: Bearer ${WITBOOST_JWT}" \
-H "Accept: text/event-stream" \
"${API}/release-operations/${RELEASE_OPERATION_ID}/stream"

Operation history is temporary: terminal results are retained for 30 minutes and may be lost if the service restarts. An operation ID is not a credential; callers still need the relevant project permissions.

4. Review the descriptor​

After the release operation succeeds, set the exact result.version returned by its status response:

export VERSION="<result.version>"

The version can identify a draft or a promoted release. Use it exactly as returned, for example 0.27-SNAPSHOT-1, not 0.27.0-SNAPSHOT-1.

Fetch the descriptor rendered for the target environment. The response is YAML and can be reviewed or stored as a pipeline artifact:

curl --fail --remove-on-error -sS -G \
-H "Authorization: Bearer ${WITBOOST_JWT}" \
--data-urlencode "env=${ENVIRONMENT}" \
"${API}/projects/${PROJECT_URN}/releases/${VERSION}/descriptor" \
-o descriptor.yaml

5. Deploy and monitor the deployment​

Submit a full deployment of the selected draft or released version:

curl -sS -X POST \
-H "Authorization: Bearer ${WITBOOST_JWT}" \
"${API}/projects/${PROJECT_URN}/releases/${VERSION}/deployment?env=${ENVIRONMENT}"

The 202 response contains a provisioning operationId. This is a different ID from the release operation ID. Acceptance means provisioning was submitted, not that it has finished.

export PROVISIONING_OPERATION_ID="<operationId from the deployment response>"

curl -sS \
-H "Authorization: Bearer ${WITBOOST_JWT}" \
"${API}/provisioning-operations/${PROVISIONING_OPERATION_ID}/status"

Poll this endpoint until the operation reaches a terminal status such as COMPLETED or FAILED. To inspect the project's current state in an environment, including component states and available versions, use the project status endpoint instead:

curl -sS -G \
-H "Authorization: Bearer ${WITBOOST_JWT}" \
--data-urlencode "env=${ENVIRONMENT}" \
"${API}/projects/${PROJECT_URN}/provisioning/status"

An operation reports the outcome of that particular request; current project status can change after the operation completes. Neither response exposes the provisioning plan.

If deployment returns 409 because Deploy Approval is required, follow the existing Deploy Approval flow and retry only after approval is granted. Deployment also applies the existing validation and governance checks.

6. Promote when ready​

Once the draft has been tested and is ready to become an immutable release, promote it:

curl -sS -X POST \
-H "Authorization: Bearer ${WITBOOST_JWT}" \
"${API}/projects/${PROJECT_URN}/releases/draft/promotion"

Promotion returns 202 and a new release operationId. Track it as described in Wait for the release operation. On succeeded, use the new result.version for any subsequent descriptor or deployment request; do not reuse the snapshot version. Promotion does not deploy the release. To deploy it, repeat the deployment steps with the promoted version and the desired environment.

7. Undeploy a release​

To remove a deployment from an environment, submit an undeployment for the exact release version:

curl -sS -X POST \
-H "Authorization: Bearer ${WITBOOST_JWT}" \
"${API}/projects/${PROJECT_URN}/releases/${VERSION}/undeployment?env=${ENVIRONMENT}"

Track the returned provisioning operationId using the same operation-status endpoint as for deployment. An accepted undeployment is not yet a completed undeployment.

Troubleshooting​

  • 400: check the project URN, exact version, environment, request body, or pagination cursor. Cursors expire and must be reused with the same project and page size.
  • 401 or 403: check authentication and your project and environment permissions. Refresh an expired JWT before making further requests.
  • 404: the active-draft lookup returns this when there is no draft. Other lookups can return it for an unknown release or operation; inaccessible provisioning operation IDs also return 404.
  • 409: read the error's userMessage and moreInfo. It can indicate an invalid draft transition, a competing release operation, or a deployment approval requirement.
  • Failed or unavailable operation: do not assume there were no side effects. Inspect the project's current draft, releases, and environment state before deciding whether to retry.