Account Instance API
Account instances 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 account instances.
Base URL for Account Instance REST API
http://host:port/flexdeploy/rest/v1/topology/integrations/account/{accountType}
Each function returns a JSON account instance object. The account instance object has these attributes:
Attribute | Type | Description |
---|---|---|
name | String | Name of the account instance |
instanceId | Long | Id of the account instance |
isActive | Boolean | A boolean that tracks whether or not the account instance is active |
code | String | Unique code of the account instance |
provider | String | Name of the account provider |
description | String | Description of the account instance |
properties | List<PropertyValuePojo> | The properties associated with the account instance, determined by provider. More info on the contents of each PropertyValuePojo is included below |
Each property contains the following:
Attribute | Type | Description |
---|---|---|
propertyName | String | Key name of the property |
propertyValue | String | Value of the property |
credentialId | Long | Id of the credential associated with the property. Applicable only for encrypted properties |
GET
There are two implementations of GET. One will find an account instance with the given Id and return the JSON representation of the account instance. The other will find a list of account instances matching the parameters supplied to it.
GET by ID
This GET service will find an account instance with the given Id and return the JSON representation of the object.
API URL
http://host:port/flexdeploy/rest/v1/topology/integrations/account/{accountType}/{id}
Request
Parameter | Type | Required | Description |
---|---|---|---|
id | URL | Yes | URL parameter for the id of the account instance to get |
accountType | URL | Yes | URL parameter for the type of account. Possible values: cloud |
Example
If we had a cloud account instance in our database with an Id of 11101, we can run a GET request at the following URL:
http://host:port/flexdeploy/rest/v1/topology/integrations/account/cloud/11101
and the GET request would return a JSON account instance object for that instance:
{ "name": "aws", "properties": [ { "propertyName": "FDAWSACCT_ACCESS_KEY", "propertyValue": "AKIAYMDHK5KKYHRC47US", "credentialId": null }, { "propertyName": "FDAWSACCT_SECRET_KEY", "propertyValue": "*****", "credentialId": 11501 } ], "provider": "AWS", "description": "Example account", "instanceId": 11101, "code": "AWS", "isActive": true }
GET (Using Query Parameters)
This GET service will return a list of account instances in the form of JSON objects based on the query parameters code, name, and provider. account instances are only returned if they match all of the specified query parameters. If no query parameters are given, this request will return the entire list of account instances.
API URLs
http://host:port/flexdeploy/rest/v1/topology/integrations/account/{accountType}?
Append the following character sequences to the above URL to specify Query parameters.
Use '&' between successive query parameters:
instanceCode={instanceCode}
instanceName={instanceName}
provider={provider}
Examples:
To search by code only:
http://host:port/flexdeploy/rest/v1/topology/integrations/account/{accountType}?instanceCode={instanceCode}
To search by provider only:
http://host:port/flexdeploy/rest/v1/topology/integrations/account/{accountType}?provider={provider}
To search by code and name:
http://host:port/flexdeploy/rest/v1/topology/integrations/account/{accountType}?instanceCode={instanceCode}&instanceName={instanceName}
The query parameters are not case sensitive. Searching by instanceCode=CODE is the same as searching by instanceCode=code.
Request
Parameter | Type | Required | Description |
---|---|---|---|
instanceCode | URL | No | This is a URL query parameter for the code which is used to search the account instances. |
instanceName | URL | No | This is a URL query parameter for the name which is used to search the account instances. |
provider | URL | No | This is a URL query parameter for the provider which is used to search the account instances. |
Example
If we had 2 account instances in our database with AWS as provider, when we run a GET request at the following URL:
http://host:port/flexdeploy/rest/v1/topology/integrations/account/cloud?provider=aws
The GET request would return the following JSON account instance object
[ { "name": "AWS New", "properties": [ { "propertyName": "FDAWSACCT_ACCESS_KEY", "propertyValue": "AKIAYMDHK5KKYH5RC7US", "credentialId": null }, { "propertyName": "FDAWSACCT_SECRET_KEY", "propertyValue": "*****", "credentialId": 11501 } ], "provider": "AWS", "description": "1st cloud account", "instanceId": 20701, "code": "AWSNEW", "isActive": true }, { "instanceId": 20809, "code": "AWSOLD", "name": "awsOld", "provider": "AWS", "description": "Former AWS account", "isActive": false, "properties": [ { "propertyName": "FDAWSACCT_ACCESS_KEY", "propertyValue": "AR3OTNMDPY5KKYHC47US", "credentialId": null }, { "propertyName": "FDAWSACCT_SECRET_KEY", "propertyValue": "*****", "credentialId": 11496 } ] } ]
POST
This POST service will create a new account instance with the same attributes as the given JSON object.
API URL
http://host:port/flexdeploy/rest/v1/topology/integrations/account/{accountType}
Request
Attribute | Required | Type | Description |
---|---|---|---|
accountType | Yes | URL | URL parameter for the type of account. Possible values: cloud |
name | Yes | String | Name of the account instance |
isActive | No | Boolean | A boolean that tracks whether or not the account instance is active. Defaults to yes |
code | Yes | String | Unique code of the account instance |
provider | Yes | String | Name of the account provider |
description | No | String | Description of the account instance |
properties | Yes* | List<PropertyValuePojo> | The properties associated with the account instance, determined by provider. More info on the contents of each PropertyValuePojo is included below *The required properties are determined by provider |
Each property contains the following:
Attribute | Required | Type | Description |
---|---|---|---|
propertyName | Yes | String | Key name of the property |
propertyValue | Yes* | String | Value of the property. Providing the property value for credentials in the local store will update the value, but is not allowed for any other credential store providers. *Either propertyValue or credentialId is required for encrypted properties |
credentialId | Yes* | Long | Id of the credential associated with the property. Applicable only for encrypted properties *Either propertyValue or credentialId is required for encrypted properties |
Example
If the POST request receives the following JSON account instance object at this URL: http://host:port/flexdeploy/rest/v1/topology/integrations/account/cloud
{ "provider": "AWS", "name": "AWS Account", "properties": [ { "propertyName": "FDAWSACCT_ACCESS_KEY", "propertyValue": "AKIAYMDHK5KKYHRC47US", "credentialId": null }, { "propertyName": "FDAWSACCT_SECRET_KEY", "propertyValue": "secretKey" } ], "description": "Adding description with POST", "code": "AWSACCT", "isActive": true }
The following account instance object will then be created as a new row in the database.
{ "instanceId": 74852, "provider": "AWS", "name": "AWS Account", "properties": [ { "propertyName": "FDAWSACCT_ACCESS_KEY", "propertyValue": "AKIAYMDHK5KKYHRC47US", "credentialId": null }, { "propertyName": "FDAWSACCT_SECRET_KEY", "propertyValue": "*****", "credentialId": 46482 } ], "description": "Adding description with POST", "code": "AWSACCT", "isActive": true }
PUT
This PUT service will update all attributes of an account instance with the given Id based on the attributes of a JSON object parameters.
API URL
http://host:port/flexdeploy/rest/v1/topology/integrations/account/{accountType}/{id}
Request
Attribute | Required | Type | Description |
---|---|---|---|
accountType | Yes | URL | URL parameter for the type of account. Possible values: cloud |
id | Yes | URL | URL parameter for the id of the account instance to update |
name | Yes | String | Name of the account instance |
isActive | No | Boolean | A boolean that tracks whether or not the account instance is active. Defaults to yes |
code | Yes | String | Unique code of the account instance |
description | No | String | Description of the account instance |
properties | Yes* | List<PropertyValuePojo> | The properties associated with the account instance, determined by provider. More info on the contents of each PropertyValuePojo is included below *The required properties are determined by provider |
Each property contains the following:
Attribute | Required | Type | Description |
---|---|---|---|
propertyName | Yes | String | Key name of the property |
propertyValue | Yes* | String | Value of the property. Providing the property value for credentials in the local store will update the value, but is not allowed for any other credential store providers. *Either propertyValue or credentialId is required for encrypted properties |
credentialId | Yes* | Long | Id of the credential associated with the property. Applicable only for encrypted properties *Either propertyValue or credentialId is required for encrypted properties |
Account provider cannot be modified for a PUT request.
Example
If we had an account instance in our database with the following attributes:
{ "instanceId": 74852, "provider": "AWS", "name": "AWS Account", "properties": [ { "propertyName": "FDAWSACCT_ACCESS_KEY", "propertyValue": "AKIAYMDHK5KKYHRC47US", "credentialId": null }, { "propertyName": "FDAWSACCT_SECRET_KEY", "propertyValue": "*****", "credentialId": 46482 } ], "description": "Adding description with POST", "code": "AWSACCT", "isActive": true }
When we run a PUT request at the following URL:
http://host:port/flexdeploy/rest/v1/topology/integrations/account/cloud/74852
And the PUT request receives the following JSON account instance object,
{ "name": "AWS Account former", "properties": [ { "propertyName": "FDAWSACCT_ACCESS_KEY", "propertyValue": "AKIAYMDHK5KKYHRC47US", "credentialId": null }, { "propertyName": "FDAWSACCT_SECRET_KEY", "credentialId": 46482 } ], "description": "", "code": "AWSACCTFORMER", "isActive": false }
The PUT request would then update the account instance with Id 74852 and return the following JSON account instance object:
{ "instanceId": 74852, "name": "AWS Account former", "properties": [ { "propertyName": "FDAWSACCT_ACCESS_KEY", "propertyValue": "AKIAYMDHK5KKYHRC47US", "credentialId": null }, { "propertyName": "FDAWSACCT_SECRET_KEY", "propertyValue": "*****", "credentialId": 46482 } ], "description": "", "code": "AWSACCTFORMER", "isActive": false }
PATCH
This PATCH service will update an existing account instance with the information passed through a JSON object. If an attribute of the JSON is null, it will not be updated in the account instance.
API URL
http://host:port/flexdeploy/rest/v1/topology/integrations/account/{accountType}/{Id}
Request
Attribute | Required | Type | Description |
---|---|---|---|
accountType | Yes | URL | URL parameter for the type of account. Possible values: cloud |
id | Yes | URL | URL parameter for the id of the account instance to patch |
name | Yes | String | Name of the account instance |
isActive | No | Boolean | A boolean that tracks whether or not the account instance is active. Defaults to yes |
code | Yes | String | Unique code of the account instance |
description | No | String | Description of the account instance |
properties | Yes* | List<PropertyValuePojo> | The properties associated with the account instance, determined by provider. More info on the contents of each PropertyValuePojo is included below *The required properties are determined by provider |
Each property contains the following:
Attribute | Required | Type | Description |
---|---|---|---|
propertyName | Yes | String | Key name of the property |
propertyValue | Yes* | String | Value of the property. Providing the property value for credentials in the local store will update the value, but is not allowed for any other credential store providers. *Either propertyValue or credentialId is required for encrypted properties |
credentialId | Yes* | Long | Id of the credential associated with the property. Applicable only for encrypted properties *Either propertyValue or credentialId is required for encrypted properties |
Account provider cannot be modified for a PUT request.
Example
If we had an account instance in our database with the following attributes:
{ "instanceId": 74852, "provider": "AWS", "name": "AWS Account", "properties": [ { "propertyName": "FDAWSACCT_ACCESS_KEY", "propertyValue": "AKIAYMDHK5KKYHRC47US", "credentialId": null }, { "propertyName": "FDAWSACCT_SECRET_KEY", "propertyValue": "*****", "credentialId": 46482 } ], "description": "", "code": "AWSACCT", "isActive": true }
When we run a PATCH request at the following URL:
http://host:port/flexdeploy/rest/v1/topology/integrations/account/cloud/74852
And the PATCH request receives the following JSON account instance object,
{ "description": "Adding a description with PATCH", "properties": [ { "propertyName": "FDAWSACCT_ACCESS_KEY", "propertyValue": "HTI8REL9GHDITE3QKDP5V", "credentialId": null }, { "propertyName": "FDAWSACCT_SECRET_KEY", "credentialId": 46482 } ] }
The PATCH request would then update the account instance with Id 74852 and return the following JSON account instance object:
{ "instanceId": 74852, "provider": "AWS", "name": "AWS Account", "properties": [ { "propertyName": "FDAWSACCT_ACCESS_KEY", "propertyValue": "HTI8REL9GHDITE3QKDP5V", "credentialId": null }, { "propertyName": "FDAWSACCT_SECRET_KEY", "propertyValue": "*****", "credentialId": 46482 } ], "description": "Adding a description with PATCH", "code": "AWSACCT", "isActive": true }
- style