Anchor | ||||
---|---|---|---|---|
|
Snapshots can be created through this API using a POST service.
Info | ||
---|---|---|
| ||
http://host:port/flexdeploy/rest/release/{releaseId}/snapshot |
...
POST will receive and return a snapshot JSON object. Snapshot JSON objects can have the following attributes:
Attributes | Type | Description |
---|---|---|
snapshotName | String | The name of the snapshot is automatically generated at the time of creation |
snapshotId | Long | The id of the snapshot is returned after creation |
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 |
packageName | String | The name of the package (used for partial deployment projects only) |
projectVersionId | Long | The version id of the project |
buildEnvironmentId | Long | The build environment associated with the project |
forceBuild | Boolean | Whether or not the project should be force built |
...
POST
This POST service will create a new snapshot with the same attributes as the given JSON object.
Info | ||
---|---|---|
| ||
http://host:port/flexdeploy/rest/release/{releaseId}/snapshot |
Parameters
Attributes | Required | Type | Description |
---|---|---|---|
releaseId | Yes | URL | The release to create a snapshot from |
snapshotName | No | String | The name of the snapshot is automatically generated at the time of creation |
snapshotId | No | Long | The id of the snapshot is returned after being created |
description | No | String | The description of the snapshot |
projects | No | List<Project> | A list of projects associated with the snapshot |
projectId | Yes | Long | The id of the project |
packageName | Yes* | String | The name of the package (used for partial deployment projects only) |
projectVersionId | No | Long | The version id of the project to use instead of creating a new version |
buildEnvironmentId | No | Long | The build environment associated with the project |
forceBuild | No | Boolean | Whether or not the project should be force built |
*only if it's a partial deployment project
...
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,
Code Block | ||||
---|---|---|---|---|
| ||||
{ "description": "example releasesnapshot creation", "projects": [ { "projectId": 10000, "packageName": "package1", "projectVersionId": 10001 }, { "projectId": 10000, "packageName": "package2", "forceBuild": true }, { "projectId": 10002, "buildEnvironmentId": 10003 } } |
The following environment snapshot object will then be created as a new row in the database.in FlexDeploy:
Code Block | ||||
---|---|---|---|---|
| ||||
{ "descriptionsnapshotId": "This is Environment 1" 10005, "instancessnapshotName": [15100], "isActive": true, "environmentCode": "ENV1", "sortNumber": 1, "environmentId": 11101, "isBuildEnvironment": true, "environmentName": "Env 1" } |
PUT
This PUT service will update all attributes of an environment with the given Id based on the attributes of a JSON object parameters.
Info | ||
---|---|---|
| ||
Code Block | ||||
---|---|---|---|---|
| ||||
{ "07-09-2018 12:12:03", "description": "This is Put 1example snapshotcreation", "instancesprojects": [15100], { "isActiveprojectId": false10000, "environmentCode "packageName": "PUT1package1", "sortNumber "projectVersionId": 610001, "environmentId "forceBuild": 00000false, "isBuildEnvironment "buildEnvironmentId": true, "environmentName": "Put 1" } |
Parameters
...
Parameters
...
Type
...
Required
...
Description
...
Example
If we had an environment in our database with an Id of 11101 and had the following attributes
Code Block | ||||
---|---|---|---|---|
| ||||
{
"description": "This is Environment 1"
"instances": [15100],
"isActive": true,
"environmentCode": "ENV1",
"sortNumber": 1,
"environmentId": 11101,
"isBuildEnvironment": true,
"environmentName": "Env 1"
} |
When we run a PUT request at the following URL
http://host:port/flexdeploy/rest/topology/environment/11101
And the PUT request receives the following JSON environment object,
Code Block | ||||
---|---|---|---|---|
| ||||
{
"description": "This is the updated Environment 1",
"instances": [15101],
"isActive": true,
"environmentCode": "PUT2",
"sortNumber": 2,
"environmentId": 11101,
"isBuildEnvironment": false,
"environmentName": "PUT 2"
} |
The PUT request would then update the environment with Id 11101 and return the following JSON environment object
Code Block | ||||
---|---|---|---|---|
| ||||
{
"description": "This is the updated Environment 1",
"instances": [15101],
"isActive": true,
"environmentCode": "PUT2",
"sortNumber": 2,
"environmentId": 11101,
"isBuildEnvironment": false,
"environmentName": "PUT 2"
} |
PATCH
This PATCH service will update an existing environment with the information passed through a JSON object. If an attribute of the JSON is null it will not be updated in the environment.
Info | ||
---|---|---|
| ||
Parameters
...
Parameters
...
Type
...
Required
...
Description
...
Example
If we had an environment in our database with an Id of 11101 and had the following attributes
Code Block | ||||
---|---|---|---|---|
| ||||
{
"description": "This is Environment 1",
"instances": [15101],
"isActive": true,
"environmentCode": "ENV1",
"sortNumber": 1,
"environmentId": 11101,
"isBuildEnvironment": false,
"environmentName": "Env 1"
} |
When we run a PATCH request at the following URL
http://host:port/flexdeploy/rest/topology/environment/11101
And the PATCH request receives the following JSON environment object,
Code Block | ||||
---|---|---|---|---|
| ||||
{
"description": "This is Patch with some null attributes",
"instances": [15102,15103],
"isActive": null,
"environmentCode": null,
"sortNumber": 7,
"environmentId": null,
"isBuildEnvironment": false,
"environmentName": "Patch with some null"
} |
The PATCH request would then update the environment with Id 11101 and return the following JSON environment object
Code Block | ||||
---|---|---|---|---|
| ||||
{ "description": "This is Patch with some null attributes", "instances": [15102,15103], "isActive": true, "environmentCode": "ENV1", "sortNumber": 7, "environmentId": 11101, "isBuildEnvironment": false, "environmentName": "Patch with some null"20003 }, { "projectId": 10000, "packageName": "package2", "projectVersionId": null, "forceBuild": true, "buildEnvironmentId": 20003 }, { "projectId": 10002, "packageName": null, "forceBuild": false, "projectVersionId": null, "buildEnvironmentId": 10003 } } |