Snapshots can be created through this API using a POST service.
Base URL for Snapshot REST API
http://host:port/flexdeploy/rest/releases/{releaseId}/snapshot
POST will receive a snapshot input JSON object and return a snapshot JSON object. Snapshot input JSON objects can have the following attributes:
Attributes | Type | Description |
---|---|---|
action | String |
|
description | String | The description of the snapshot |
snapshotVersionInputs | List<SnapshotVersionInputPojo> | A list of project version to be built or associated with the snapshot. |
SnapshotVersionInput has following attributes:
Attributes | Type | Description |
---|---|---|
projectId | Long | The id of the project |
projectVersionId | Long | The version id of the project |
packageName | String | The name of the package (used for partial deployment projects only) |
buildEnvironmentId | Long | The build environment associated with the project |
forceBuild | Boolean | Whether or not the project should be force built |
Snapshot JSON objects can having the following attributes:
Attributes | Type | Description |
---|---|---|
snapshotId | Long | The id of the snapshot |
snapshotName | String | The name of the snapshot, which is the time when the snapshot was created |
snapshotStatus | String | The status of the snapshot |
description | String | The description of the snapshot |
snapshotVersions | List<SnapshotVersionPojo> | The version information about the projects associated with the snapshot |
SnapshotVersion has following attributes:
Attributes | Type | Description |
---|---|---|
projectId | Long | The id of the project |
projectStreamId | Long | Stream included in release for the project. |
projectVersionId | Long | The version id of the project |
packageName | String | The name of the package (used for partial deployment projects only) |
requestAllFiles | Boolean | Whether or not the project was told to request all files |
snapshotVersionStatus | String | The current status of the snapshot |
POST (create snapshot)
This POST service will create a new snapshot with the same attributes as the given JSON object.
API URL
http://host:port/flexdeploy/rest/releases/{releaseId}/snapshot
Parameters
Attributes | Type | Required | Description |
---|---|---|---|
action | String | Yes | should be set to createSnapshot for this API. |
description | String | No | The description of the snapshot |
snapshotVersionInputs | List<SnapshotVersionInputPojo> | No |
|
Parameters for each element of snapshotVersionInputs. If not supplied all projects configured in Release will be included. | |||
projectId | Long | Yes | Project associated with release. |
packageName | String | Yes* | The name of the package (used for partial deployment projects only) associated with release. If Partial deployment project and packageName is not supplied it will be considered all files type version. |
projectVersionId | Long | No | The version id of the project. If project version is not supplied new build will be performed. |
buildEnvironmentId | Long | Yes** | The build environment associated with the project. If not supplied and only one environment found for build instance then it will be defaulted. |
forceBuild | Boolean | No | Whether or not the project should be force built. This will be overridden to true for partial deployment project. |
* only if it's a partial deployment project
**only if the project has multiple build environments
Example
If the POST request sent to http://host:port/flexdeploy/rest/release/12345/snapshot receives the following JSON environment object,
{ "action" : "createSnapshot" "description": "example snapshot creation", "snapshotVersionInputs": [ { "projectId": 10000, "packageName": "package1", "projectVersionId": 10001 }, { "projectId": 10000, "packageName": "package2", }, { "projectId": 10002, "buildEnvironmentId": 10003 } ] }
The following snapshot object will then be created in FlexDeploy:
{ "snapshotId": 10005, "snapshotName": "07-09-2018 12:12:03", "description": "example snapshot creation", "snapshotStatus": "PENDING", "snapshotVersions": [ { "projectId": 10000, "packageName": "package1", "projectVersionId": 10001, "requestAllFiles": false, "snapshotVersionStatus": "EXISTING" }, { "projectId": 10000, "packageName": "package2", "projectVersionId": null, "requestAllFiles": false, "snapshotVersionStatus": "PENDING" }, { "projectId": 10002, "packageName": null, "projectVersionId": null, "requestAllFiles": false, "snapshotVersionStatus": "PENDING" }] }
POST (promote to release)
Project versions can be promoted to a release through this POST service. Promoting a project to release will combine the specified version of the specified project with the versions of the other projects used in the last snapshot into a new snapshot.
URL for promoting a project version to a release
http://host:port/flexdeploy/rest/releases/{releaseId}/snapshot
Parameters
Attributes | Type | Required | Description |
---|---|---|---|
action | String | Yes | should be set to promoteToRelease for this API. |
description | String | No | The description of the snapshot |
snapshotVersionInputs | List<SnapshotVersionInputPojo> | No | A list containing only one project version to be associated with latest snapshot. |
Parameters for each element of snapshotVersionInputs. One and only one element is required for promote to release action. | |||
projectId | Long | Yes | Project associated with release. |
packageName | String | Yes* | The name of the package (used for partial deployment projects only) associated with release. If Partial deployment project and packageName is not supplied it will be considered all files type version. |
projectVersionId | Long | Yes | The version id of the project. If using packageName, version for package must be provided. |
Example
If the previous snapshot had the following attributes:
{ "snapshotId": 10005, "snapshotName": "07-09-2018 12:12:03", "description": "", "snapshotStatus": "INITIATED", "snapshotVersions": [ { "projectId": 10000, "packageName": "package1", "projectVersionId": 10001, "requestAllFiles": false, "snapshotVersionStatus": "EXISTING" }, { "projectId": 10000, "packageName": "package2", "projectVersionId": 10040, "requestAllFiles": false, "snapshotVersionStatus": "COMPLETED" }, { "projectId": 10002, "packageName": null, "projectVersionId": 10065, "requestAllFiles": false, "snapshotVersionStatus": "COMPLETED" }] }
And a POST request was sent to http://host:port/flexdeploy/rest/project/promote/10000/11001 with the following JSON object input:
{ "action" : "promoteToRelease" "description": "example snapshot creation", "snapshotVersionInputs": [ { "projectId": 10000, "packageName": "package1", "projectVersionId": 10025 } ] }
The following Snapshot JSON object will begin:
{ "snapshotId": 10025, "snapshotName": "07-09-2018 12:15:03", "description": "", "snapshotStatus": "INITIATED", "snapshotVersions": [ { "projectId": 10000, "packageName": "package1", "projectVersionId": 10025, "requestAllFiles": false, "snapshotVersionStatus": "EXISTING" }, { "projectId": 10000, "packageName": "package2", "projectVersionId": 10040, "requestAllFiles": false, "snapshotVersionStatus": "EXISTING" }, { "projectId": 10002, "packageName": null, "projectVersionId": 10065, "requestAllFiles": false, "snapshotVersionStatus": "EXISTING" }] }