Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Snapshots can be created through this API using a POST service.

Info
titleBase URL for Snapshot REST API

http://host:port/flexdeploy/rest/release/{releaseId}/snapshot

Table of Contents
maxLevel1

POST will receive a snapshot input JSON object and return a snapshot JSON object. Snapshot input JSON objects can have the following attributes:

...

  • createSnapshot
  • promoteToRelease - one and only one snapshotVersionInputs should be provided

...

SnapshotVersionInput has following attributes:

...

Snapshot JSON objects can having the following attributes:

...

snapshotId

...

SnapshotVersion has following attributes:

...

Snapshots can be created through this API using a POST service and snapshot information can be retrieved using a GET service.

Include Page
REST V1 Authentication
REST V1 Authentication

Table of Contents
maxLevel2

GET

There are two implementations of GET. One will find a Snapshot with the given release id and snapshot id and return the JSON representation of the Snapshot. The other will find a list of Snapshots matching the parameters supplied to it.

GET (By Id)

This GET service will return the JSON representation of a snapshot given a release id and snapshot Id.

Info
titleAPI URL

http://host:port/flexdeploy/rest/v1/releases/{releaseId}/snapshot/{snapshotId}

Request

ParameterTypeRequiredDescription
snapshotIdURLYesPath parameter for the snapshot Id which is used to return a snapshot
releaseIdURLYesPath parameter for the release Id which contains the snapshot that will be returned

Response

Snapshot JSON objects can having the following attributes:

AttributeTypeDescription

snapshotId

LongThe id of the

...

snapshot

...

snapshotName

...

Back to Top

POST (create snapshot)

This POST service will create a new snapshot with the same attributes as the given JSON object.

Info
titleAPI URL

http://host:port/flexdeploy/rest/release/{releaseId}/snapshot

Parameters

...

StringThe name of the snapshot, which is generated based on the time of creation
snapshotStatusString

The status of the snapshot. Possible values are:

  • COMPLETED - The snapshot was successfully assembled, but has not yet been sent to pipeline for execution. Snapshot will stay in this status for very short time and will transition to INITIATED.
  • FAILED - The snapshot failed to be assembled (which could mean the underlying build failed).
  • FAILED TO INITIATE - The snapshot was assembled, but failed to be sent to the pipeline for execution.
  • INITIATED - The snapshot has been sent to the pipeline for execution.
  • PENDING - The snapshot is in the process of being assembled and sent to the pipeline for execution.
descriptionStringThe description of the snapshot

...

snapshotVersions

...

  • A list of snapshot versions to be built or associated with new snapshot.
  • If you do not provide projectVersionId, build will be initiated.
  • If you do not supply specific project that is configured in release, it will be added for build. projectId and packageName is used to identify if project is configured in Release or not.
  • If you supply projectId and packageName combination that is not part of release, exception will be thrown.

...

List<SnapshotVersionPojo>The version information about the projects/packages contained within this snapshot
snapshotVariablesList<SnapshotVariable>The related snapshot variables
linksList<Link>List of any relevant links for the object.

Elements of snapshotVersions has following attributes:

AttributeTypeDescription
projectIdLongThe id of the project
projectStreamIdLongThe id of the Stream which the project/package was built from
projectVersionIdLongThe version id of the project
packageNameStringThe name of the package (

...

partial deployment projects only)

...

* 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,

...

themeEclipse
titlePOST JSON

...

requestAllFilesBooleanWhether or not the project includes all files (partial deployment projects only)
snapshotVersionStatusString

The current status of the individual project version within the snapshot. Possible values are:

  • PENDING - The project is has not yet been built for the snapshot. 
  • SUBMITTED - The project is currently being built for the snapshot.
  • COMPLETED - The project has been built successfully for the snapshot.
  • FAILED - The project has failed to build.
  • EXISTING - The snapshot is utilizing an already built version of the project.

Elements of snapshotVariables has the following attributes:

AttributeTypeDescription
displayNameStringDisplay name
codeStringCode for the variable
descriptionStringDescription of the variable
dataTypeStringData type of the variable
valueStringValue of the variable
updatedByStringWho last updated this variable
updatedOnStringLast time the variable was updated

Include Page
REST V1 Link Response
REST V1 Link Response

Response Codes

HTTP CodeDescription
200Snapshot was found and returned
400Bad request
401Authentication failure
403Authorization failure (no access to resource)
404Release or snapshot not found
500Unexpected internal server error

Example

If a snapshot in our database had an id of 10005 and releaseId of 14321 and a GET request was sent to http://host:port/flexdeploy/rest/v1/releases/14321/snapshot/10005

A Snapshot JSON object will be returned with snapshot information:

Code Block
themeEclipse
titleResponse JSON
{
	"snapshotId": 10005,
	"snapshotName": "07-09-2018 12:15:03",
	"description": "",
	"snapshotStatus": "INITIATED",
	"snapshotVersions": [
	{
		"projectId": 

...

10000,
		"

...

packageName": 

...

"package1",
		

...

The following snapshot object will then be created in FlexDeploy:

...

themeEclipse
titlePOST JSON

...

"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"
	}],
	"snapshotVariables": [
	{
		"

...

value": 

...

"",
		"

...

displayName": "

...

Name",
		"

...

description": 

...

"description",
		"

...

dataType": 

...

"String",
		"

...

code": "

...

VARIABLE"

...

,
	

...

	"

...

updatedBy": 

...

"fduser",
		"

...

updatedOn": 

...

"07-02-2020 12:37:18"
	}],

...

	"

...

links":

...

Back to Top

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.

Info
titleURL for promoting a project version to a release

http://host:port/flexdeploy/rest/release/{releaseId}/snapshot

Parameters

...

 [
        {
                "type": "UI",
                "link": "http://host:port/flexdeploy/faces/releases?dashboard=true&relSnapshotId=10005&relDefinitionId=14321"
        }
    ]
}

GET (Using Query Parameters)

This GET service will return the JSON representation of a list of snapshots given the release id and snapshot query parameters. Results are sorted so latest snapshots are returned first.

Info
titleAPI URL

http://host:port/flexdeploy/rest/v1/releases/{releaseId}/snapshot

Request

ParameterTypeRequiredDescription
releaseIdLong (URL)YesPath parameter for the release Id. All returned snapshots will be in this release.
snapshotNameString (Query)NoQuery based on the generated name of the snapshot. Name is case sensitive and must be exact.
snapshotStatusString (Query)NoQuery based on the status of the snapshot. Possible statuses are COMPLETED, FAILED, FAILED TO INITIATE, INITIATED, and PENDING. Status is case insensitive.
limitInteger (Query)NoLimits the number of snapshots returned to specified value. If no limit is provided, all snapshots matching the criteria are returned.


Tip

If no query parameters are provided, all the snapshots in the release will be returned.

Response

Snapshot JSON objects can have the following attributes:

AttributeTypeDescription
snapshotIdLongThe id of the snapshot
snapshotNameString The name of the snapshot, which is generated based on the time of creation
snapshotStatusString

The status of the snapshot. Possible values are:

  • COMPLETED - The snapshot was successfully assembled, but has not yet been sent to pipeline for execution.
  • FAILED - The snapshot failed to be assembled (which could mean the underlying build failed).
  • FAILED TO INITIATE - The snapshot was assembled, but failed to be sent to the pipeline for execution.
  • INITIATED - The snapshot has been sent to the pipeline for execution.
  • PENDING - The snapshot is in the process of being assembled and sent to the pipeline for execution.
descriptionStringThe description of the snapshot
snapshotVersionsList<SnapshotVersionPojo>The version information about the projects/packages contained within this snapshot
snapshotVariablesList<SnapshotVariable>The related snapshot variables

Elements of snapshotVersions has the following attributes:

AttributeTypeDescription
projectIdLongThe id of the project
projectStreamIdLongThe id of the Stream which the project/package was built from
projectVersionIdLongThe version id of the project
packageNameStringThe name of the package (partial deployment projects only)
requestAllFilesBooleanWhether or not the project includes all files (partial deployment projects only)
snapshotVersionStatusString

The current status of the individual project version within the snapshot. Possible values are: 

  • PENDING - The project is has not yet been built for the snapshot. 
  • SUBMITTED - The project is currently being built for the snapshot.
  • COMPLETED - The project has been built successfully for the snapshot.
  • FAILED - The project has failed to build.
  • EXISTING - The snapshot is utilizing an already built version of the project.

Elements of snapshotVariables have the following attributes:

AttributeTypeDescription
displayNameStringDisplay name
codeStringCode for the variable
descriptionStringDescription of the variable
dataTypeStringData type of the variable
valueStringValue of the variable
updatedByStringWho last updated this variable
updatedOnStringLast time the variable was updated

Response Codes

HTTP CodeDescription
200Search successful and results returned
400Bad request
401Authentication failure
403Authorization failure (no access to resource)
500Unexpected internal server error

Example

If we have a release with id 11211 and want to see the latest 2 snapshots with a status of COMPLETED, we would send this request:

Request: http://host:port/flexdeploy/rest/v1/releases/11211/snapshot?status=COMPLETED&limit=2

A GET request would be triggered and return the following JSON snapshots object:

Code Block
themeEclipse
titleGET JSON Response
[
	{
		"snapshotId": 11501,
		"snapshotStatus": "COMPLETED",
		"snapshotVersions": [
		{
			"snapshotVersionStatus": "COMPLETED",
			"projectVersionId": 33129,
			"projectId": 25208,
			"packageName": null,
			"projectStreamId": 25209,
			"requestAllFiles": false
		},
		{
			"snapshotVersionStatus": "COMPLETED",
			"projectVersionId": 33175,
			"projectId": 25228,
			"packageName": "Package1",
			"projectStreamId": 25229,
			"requestAllFiles": false
		},
		{
			"snapshotVersionStatus": "COMPLETED",
			"projectVersionId": 33146,
			"projectId": 25228,
			"packageName": "Package2",
			"projectStreamId": 25229,
			"requestAllFiles": false
		}
		],
		"snapshotName": "02-08-2019 08:52:02",
		"description": null,
		"snapshotVariables": [
		{
			"value": "",
			"displayName": "Name",
			"description": "description",
			"dataType": "String",
			"code": "VARIABLE",
			"updatedBy": "fduser",
			"updatedOn": "07-02-2020 12:37:18"
		}]
	},
	{
		"snapshotId": 11346,
		"snapshotStatus": "COMPLETED",
		"snapshotVersions": [
		{
			"snapshotVersionStatus": "COMPLETED",
			"projectVersionId": 32466,
			"projectId": 25208,
			"packageName": null,
			"projectStreamId": 25209,
			"requestAllFiles": false
		},
		{
			"snapshotVersionStatus": "COMPLETED",
			"projectVersionId": 32436,
			"projectId": 25228,
			"packageName": null,
			"projectStreamId": 25229,
			"requestAllFiles": true
		}
		],
	"snapshotName": "02-06-2019 16:35:04",
	"description": null,
	"snapshotVariables": []
	}
]


POST (create snapshot)

This POST service will create a new snapshot with the same attributes as the given JSON object.

Info
titleAPI URL

http://host:port/flexdeploy/rest/v1/releases/{releaseId}/snapshot

Request

POST will receive a snapshot input JSON object and return a snapshot JSON object. Snapshot input JSON objects can have the following attributes:

AttributesTypeRequiredDescription
releaseIdURLYesPath parameter for the release Id where the snapshot will be added
actionStringYes

should be set to createSnapshot for this API.

descriptionStringNoThe description of the snapshot
snapshotVersionInputsList<SnapshotVersionInputPojo>No
  • A list of project versions to be built or existing versions to be associated with new snapshot.
  • If you do not provide projectVersionId, build will be initiated.
  • If you do not supply specific project that is configured in release, it will be added for build. projectId and packageName is used to identify if project is configured in Release or not.
  • If you supply projectId and packageName combination that is not part of release, exception will be thrown.
  • If you do not provide anything for this attribute, build will be initiated for all project in Release.

Elements of snapshotVersionInputs has following attributes:

AttributesTypeRequiredDescription
projectIdLongYesProject associated with release.
projectVersionIdLongNoThe version id of the project. If project version is not supplied new build will be performed.
packageNameString

Yes for partial deploy,

otherwise No

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.
buildEnvironmentIdLongNoThe build environment associated with the project. If not supplied and only one environment found for build instance then it will be defaulted.
forceBuildBooleanNoWhether or not the project should be force built. This will be overridden to true for partial deployment project.

Response

Snapshot JSON objects can having the following attributes:

AttributesTypeDescription

snapshotId

LongThe id of the snapshot
snapshotNameStringThe name of the snapshot, which is the time when the snapshot was created
snapshotStatusString

The status of the snapshot. Possible values are:

  • COMPLETED - The snapshot was successfully assembled, but has not yet been sent to pipeline for execution.
  • FAILED - The snapshot failed to be assembled (which could mean the underlying build failed).
  • FAILED TO INITIATE - The snapshot was assembled, but failed to be sent to the pipeline for execution.
  • INITIATED - The snapshot has been sent to the pipeline for execution.
  • PENDING - The snapshot is in the process of being assembled and set to the pipeline for execution.
descriptionStringThe description of the snapshot
snapshotVersionsList<SnapshotVersionPojo>The version information about the projects associated with the snapshot

Elements of snapshotVersions has following attributes:

AttributesTypeDescription
projectIdLongThe id of the project
projectStreamIdLongThe id of the Stream which the project/package was built from.
projectVersionIdLongThe version id of the project
packageNameStringThe name of the package (used for partial deployment projects only)
requestAllFilesBooleanWhether or not the project was told to request all files
snapshotVersionStatusString

The current status of the individual project version within the snapshot. Possible values are:

  • PENDING - The project is has not yet been built for the snapshot. 
  • SUBMITTED - The project is currently being built for the snapshot.
  • COMPLETED - The project has been built successfully for the snapshot.
  • FAILED - The project has failed to build.
  • EXISTING - The snapshot is utilizing an already built version of the project.

Response Codes

HTTP CodeDescription
201Snapshot created
401Authentication failure
403Authorization failure (no access to resource)
404Release not found
500Unexpected internal server error

Example

If the POST request sent to http://host:port/flexdeploy/rest/v1/releases/12345/snapshot receives the following JSON environment object,

Code Block
themeEclipse
titlePOST JSON
{
	"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:

Code Block
themeEclipse
titlePOST JSON
{
	"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.

Info
titleURL for promoting a project version to a release

http://host:port/flexdeploy/rest/v1/releases/{releaseId}/snapshot

Request

POST will receive a snapshot input JSON object and return a snapshot JSON object. Snapshot input JSON objects can have the following attributes:

AttributesTypeRequiredDescription
releaseIdURLYesPath parameter for the release Id where the snapshot will be added
actionStringYesshould be set to promoteToRelease for this API.
descriptionStringNoThe description of the snapshot
snapshotVersionInputsList<SnapshotVersionInputPojo>YesOne and only one element is required for promote to release action.

Elements of snapshotVersionInputs has following attributes:

AttributesTypeRequiredDescription
projectIdLongYesProject associated with release.
projectVersionIdLongYesThe version id of the project. If using packageName, version for package must be provided.
packageNameStringNoThe 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.

Response

Snapshot JSON objects can having the following attributes:

AttributesTypeDescription

snapshotId

LongThe id of the snapshot
snapshotNameStringThe name of the snapshot, which is the time when the snapshot was created
snapshotStatusString

The status of the snapshot. Possible values are:

  • COMPLETED - The snapshot was successfully assembled, but has not yet been sent to pipeline for execution.
  • FAILED - The snapshot failed to be assembled (which could mean the underlying build failed).
  • FAILED TO INITIATE - The snapshot was assembled, but failed to be sent to the pipeline for execution.
  • INITIATED - The snapshot has been sent to the pipeline for execution.
  • PENDING - The snapshot is in the process of being assembled and set to the pipeline for execution.
descriptionStringThe description of the snapshot
snapshotVersionsList<SnapshotVersionPojo>The version information about the projects associated with the snapshot

Elements of snapshotVersions has following attributes:

AttributesTypeDescription
projectIdLongThe id of the project
projectStreamIdLongThe id of the Stream which the project/package was built from.
projectVersionIdLongThe version id of the project
packageNameStringThe name of the package (used for partial deployment projects only)
requestAllFilesBooleanWhether or not the project was told to request all files
snapshotVersionStatusString

The current status of the individual project version within the snapshot. Possible values are:

  • PENDING - The project is has not yet been built for the snapshot. 
  • SUBMITTED - The project is currently being built for the snapshot.
  • COMPLETED - The project has been built successfully for the snapshot.
  • FAILED - The project has failed to build.
  • EXISTING - The snapshot is utilizing an already built version of the project.

Response Codes

HTTP CodeDescription
201Snapshot created
401Authentication failure
403Authorization failure (no access to resource)
404Release not found
500Unexpected internal server error

Example

If the previous snapshot had the following attributes:

Code Block
themeEclipse
titleCurrent JSON
{
	"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": null10040,
		"requestAllFiles": false,
		"snapshotVersionStatus": "COMPLETED"
	},
	{
		"projectId": 10002,
		"packageName": null,
		"projectVersionId": null10065,
		"requestAllFiles": false,
		"snapshotVersionStatus": "COMPLETED"
	}]
}

And a POST request was sent to http://host:port/flexdeploy/rest/projectv1/promotereleases/10000/11001 with {releaseId}/snapshot with the following JSON object input:

Code Block
themeEclipse
titlePOST JSON
{
	"action" : "promoteToRelease",
    "description": "example snapshot creation",
	"snapshotVersionInputs": [
	{
		"projectId": 10000,
		"packageName": "package1",
		"projectVersionId": 10025
	} ]
}

...

Code Block
themeEclipse
titleResponse JSON
{
	"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": null10040,
		"requestAllFiles": false,
		"snapshotVersionStatus": "EXISTING"
	},
	{
		"projectId": 10002,
		"packageName": null,
		"projectVersionId": null10065,
		"requestAllFiles": false,
		"snapshotVersionStatus": "EXISTING"
	}]
}

...