This POST service will perform the same action found on the Build Request Form. It will initiate a request to build the project with the given Id. The service will return workflow request. Workflow request id from return data can be used with Workflow Request API to determine when the execution is complete.
This page includes examples for Full and Partial deploy project builds.
API URLs
http://host:port/flexdeploy/rest/v1/project/(Id)/build
Request
- If trying to build a Partial Deploy project with all of the files in the repository (equivalent to Build - All Files button in the UI), then simply remove the "projectFiles" list, and the REST API will detect that the project is meant for partial deploys automatically and perform the build with all of the files.
Parameter | Required | Type | Description |
---|---|---|---|
environmentId | Y/N | Long | This is the environment Id, not the environment name that you see on most screens. It is required if the build instance is associated to multiple environments. If only one environment is associated to the build instance, it is not required. |
streamId | Y | Long | The Id of the Stream. |
forceBuild | N | Boolean | Values are true or false. Indicates that the build should occur even if there are not SCM changes. Defaults to false. |
relatedTickets | N | String | List of Issue Tracking System tickets. |
workflowVersionOverride | N | String | Optionally the version of the workflow can be overridden. Defaults to the currently active version. |
inputs | N | List<Input> | See Common Parameters below. |
flexFields | N | List<FlexField> | See Common Parameters below. |
projectFiles | N | List<ProjectFile> | Only for partial deployment project builds. An array of objects with 2 fields each: |
packageName | N | String | Only for partial deployment project builds. Unique name to identify a build for partial deployments project. Defaults to the project version if no value is provided. If packageName is provided without projectFiles, files configured in that package will be used. If packageName is provided with projectFiles, then input is used for build and package definition is updated with this projectFiles list. If packageName and projectFiles are not provided for partial deployment project, then All Files build will be performed. |
releaseId | N | String | Id of the release to which this build is related to. If specified, a new snapshot is going to be created. |
Input
This is a list of code/value pairs for the inputs. Not all inputs need to be supplied. If an input has a default value that is acceptable for the Workflow to run, it does not need to be supplied.
Attribute | Required | Type | Description |
---|---|---|---|
code | Y | String | The code of the Input |
value | N | String | The value of the Input |
FlexField
This is a list of the code/value pairs for the FlexFields (not the Display Name). Not all FlexFields need to be supplied. If a FlexField has a default value or options that are acceptable for the workflow to run, it does not need to be changed.
Attribute | Required | Type | Description |
---|---|---|---|
code | Y | String | The code of the FlexField |
value | N | String | The value of the FlexField |
ProjectFile
Attribute | Required | Type | Description |
---|---|---|---|
path | Y | String | Fully qualified file path that is required inside the projectFiles parameter. |
scmRevision | N | Long | Optionally include the revision number that you would like to use for the build. If it is not indicated, then FlexDeploy will use the latest revision as the default. |
Response
Attributes | Type | Description |
---|---|---|
createdBy | String | |
createdOn | Date Time | |
deploymentStrategy | String or null | |
environmentId | long | |
finishDeployment | any | |
flexField1 | any | |
flexField2 | any | |
flexField3 | any | |
flexField4 | any | |
flexField5 | any | |
flexField6 | any | |
flexField7 | any | |
flexField8 | any | |
flexField9 | any | |
flexField10 | any | |
folderId | long | |
folderVersionId | long or null | |
force | boolean | indicates if force deploy or force build was selected on the request |
groupRequestId | long or null | |
inputs | array | |
instances | array | |
isException | boolean | |
newWeight | any | |
oldWeight | any | |
pipelineStageExecId | long or null | long if it was a release build, otherwise null |
pipelineStageStepExecId | long or null | long if it was a release build, otherwise null |
predeployRequestedStartTime | any | |
predeployWorkflowExecId | long or null | long if there was a predeploy workflow that executed, otherwise null |
priority | long | |
projectId | long | |
projectStreamId | long | |
projectVersionId | long | |
projectWorkflowId | long | |
relDefinitionId | long or null | long if it was a release build, otherwise null |
relSnapshotId | long or null | long if it was a release build, otherwise null |
requestedStartTime | any | null unless a delayed start time was given |
requestStatus | ENUM | READY, |
routeRule | any | |
stopOnPkgError | boolean | |
triggerType | ENUM | MANUAL |
updatedBy | string | |
updatedOn | date time with zone | |
versionNumber | long | |
workflowId | long | |
workflowRequestId | long | |
workflowType | ENUM | BUILD, |
workflowVersionOverride | any | null unless a workflow version override was specified for this request. |
Response Codes
HTTP Code | Description |
---|---|
200 | No changes were detected, no build initiated. |
201 | Project build was initiated successfully |
400 | Bad request |
401 | Authentication failure |
403 | Authorization failure (no access to resource) |
404 | Project not found |
500 | Unexpected internal server error |
Example
We can build a Project with Id 10004 with this request:
API URLs
http://host:port/flexdeploy/rest/v1/project/10004/build
Sample JSON Request
{ "environmentId": 11595, "forceBuild": false, "streamId": 3502 }
In response, we will receive a data object with information about the request.
{ "createdBy": "fdadmin", "updatedOn": "2022-04-26T20:23:08.579+0000", "createdOn": "2022-04-26T20:23:08.501+0000", "updatedBy": "fdadmin", "versionNumber": 2, "projectWorkflowId": 4103, "relDefinitionId": null, "folderVersionId": null, "workflowVersionOverride": null, "requestStatus": "READY", "requestedStartTime": null, "isException": false, "flexField1": null, "flexField2": null, "flexField3": null, "flexField4": null, "flexField5": null, "flexField6": null, "flexField7": null, "flexField8": null, "flexField9": null, "flexField10": null, "groupRequestId": null, "stopOnPkgError": false, "pipelineStageStepExecId": null, "relSnapshotId": null, "pipelineStageExecId": null, "deploymentStrategy": null, "newWeight": null, "oldWeight": null, "routeRule": null, "finishDeployment": null, "predeployWorkflowExecId": null, "predeployRequestedStartTime": null, "instances": null, "folderId": 4743642, "workflowRequestId": 275337, "projectId": 3501, "environmentId": 11595, "workflowId": 4122, "inputs": null, "projectStreamId": 3502, "force": false, "projectVersionId": 16786148, "workflowType": "BUILD", "triggerType": "MANUAL", "priority": 1 }