Snapshots can be created through this API using a POST service.
Base URL for Snapshot REST API
http://host:port/flexdeploy/rest/release/{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 |
---|---|---|
description | String | The description of the snapshot |
projects | List<Project> | A list of projects associated with the snapshot |
Projects have the 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<Version> | The version information about the projects associated with the snapshot |
Versions have the 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) |
requestAllFiles | Boolean | Whether or not the project was told to request all files |
snapshotVersionStatus | String | The current status of the snapshot |
POST
This POST service will create a new snapshot with the same attributes as the given JSON object.
API URL
http://host:port/flexdeploy/rest/release/{releaseId}/snapshot
Parameters
Attributes | Type | Required | Description |
---|---|---|---|
description | String | No | The description of the snapshot |
projects | List<Project> | No | A list of projects associated with the snapshot |
projectId | Long | Yes | The id of the project |
packageName | String | Yes* | The name of the package (used for partial deployment projects only) |
projectVersionId | Long | No | The version id of the project |
buildEnvironmentId | Long | Yes | The build environment associated with the project (used for projects with multiple build environments) |
forceBuild | Boolean | No | Whether or not the project should be force built |
*only if it's a partial deployment project
**only if the project has multiple build environments
Defaults
If some information is not included in the JSON object, the following default values will be used:
Attributes | Type | Value | Description |
---|---|---|---|
description | String | null | The description of the snapshot |
projects | List<Project> | projects associated with the release | A list of projects associated with the snapshot |
projectId | Long | project ids associated with the release | The id of the project |
packageName | String | packages associated with the release | The name of the package (used for partial deployment projects only) |
projectVersionId | Long | New project version | The version id of the project to use instead of creating a new version |
buildEnvironmentId | Long | The only build environment associated with the project, otherwise an error occurs | The build environment associated with the project |
forceBuild | Boolean | false | Whether or not the project should be force built |
Example
If the POST request sent to http://host:port/flexdeploy/rest/release/12345/snapshot receives the following JSON environment object,
{ "description": "example snapshot creation", "projects": [ { "projectId": 10000, "packageName": "package1", "projectVersionId": 10001 }, { "projectId": 10000, "packageName": "package2", "forceBuild": true }, { "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", "projects": [ { "projectId": 10000, "packageName": "package1", "projectVersionId": 10001, "requestAllFiles": false, "snapshotVersionStatus": "PENDING" }, { "projectId": 10000, "packageName": "package2", "projectVersionId": null, "requestAllFiles": false, "snapshotVersionStatus": "PENDING" }, { "projectId": 10002, "packageName": null, "projectVersionId": null, "requestAllFiles": false, "snapshotVersionStatus": "PENDING" } }