Environment API

Environment API

Environments can be accessed and modified through this API using four services: GET, POST, PUT, and PATCH. These four services allow for the retrieval, creation, complete update, and partial update of environments.

GET

There are two implementations of GET. One will find an environment with the given Id and return the JSON representation of the environment. The other will find a list of environments matching the parameters supplied to it.

GET by ID

This GET service will find an environment with the given Id and return the JSON representation of the object. 

API URL

http://host:port/flexdeploy/rest/v1/topology/environment/{Id}

Request

Parameter

Type

Required

Description

Parameter

Type

Required

Description

Id

URL

Yes

This is a URL parameter for the Id which is used to find and return an environment

Response Codes

HTTP Code

Description

HTTP Code

Description

200

Environment was found and returned

400

Bad request

401

Authentication failure

403

Authorization failure (no access to resource)

404

Environment not found

500

Unexpected internal server error

Example

If we had an environment in our database with an Id of 11101 and had the following attributes

Environment - 11101
{    "description": "This is Environment 1"     "instances": [15100],    "isActive": true,    "environmentCode": "ENV1",    "sortNumber": 1,    "environmentId": 11101,    "isBuildEnvironment": true,    "environmentName": "Env 1" }

When we run a GET request at the following URL

http://host:port/flexdeploy/rest/v1/topology/environment/11101

The GET request would return the following JSON environment object

Environment GET Return JSON
{    "description": "This is Environment 1",    "instances": [15100],    "isActive": true,    "environmentCode": "ENV1",    "sortNumber": 1,    "environmentId": 11101,    "isBuildEnvironment": true,    "environmentName": "Env 1" }

GET (Using Query Parameters)

This GET service will return a list of environments in the form of JSON objects based on the query parameters code and name. Environments are only returned if they match all of the specified query parameters. The name query parameter searches if any environment contains the value given in there name while all other query parameters check if any environment has attributes that are equal to the parameter value. If no query parameters are given this request will return the entire list of environments. 

API URLs

http://host:port/flexdeploy/rest/v1/topology/environment?

Append the following character sequences to the above URL to specify Query parameters.
Use '&' between successive query parameters: 

environmentCode={code}

environmentName={name}

Examples:
To search by code only:

http://host:port/flexdeploy/rest/v1/topology/environment?environmentCode={code}

To search by name only:

http://host:port/flexdeploy/rest/v1/topology/environment?environmentName={name}

To search by code and name:

http://host:port/flexdeploy/rest/v1/topology/environment?environmentCode={code}&environmentName={name}

The query parameters are not case sensitive. Searching by environmentName=NAME is the same as searching by environmentName=name.

Request

Parameter

Type

Required

Description

Parameter

Type

Required

Description

environmentCode

Query - String

No

This is a URL query parameter for the code which is used to search the environments.

Equals ignore case search

environmentName

Query - String

No

This is a URL query parameter for the name which is used to search the environments. The environment name parameter checks if any environment name contains the value given. 

Contains ignore case search

Response Codes

HTTP Code

Description

HTTP Code

Description

200

Search successful and results returned

400

Bad request

401

Authentication failure

403

Authorization failure (no access to resource)

500

Unexpected internal server error

The following macros are not currently supported in the footer:
  • style