Get the associated environments within the list of applications
search cancel

Get the associated environments within the list of applications

book

Article ID: 380792

calendar_today

Updated On:

Products

CA Release Automation - Release Operations Center (Nolio) CA Release Automation - DataManagement Server (Nolio)

Issue/Introduction

How to get the associated environment within the list of applications using a database sql query of a API call ?

Environment

Release Automation - All versions.

Resolution

Here are some SQL Queries to get the information directly in the database :

  • Get full list of all applications and environments :
SELECT a.APP_NAME 'Application Name', e.name 'Environment'
FROM applications a
INNER JOIN environments e ON a.ID=e.applicationId
WHERE A.APP_NAME <>'____Default Application'
ORDER BY 1,2
  • Get the list of environments for a specific application name :
SELECT a.APP_NAME 'Application Name', e.name 'Environment'
FROM applications a
INNER JOIN environments e ON a.ID=e.applicationId
WHERE A.APP_NAME ='TEST_APP2'
ORDER BY 1,2

 

Example :

 
 
Another solution is to use Rest API calls
 
Example with curl :
 
  1.  First get the application ID for TEST_APP2

    curl "http://nac_name:8080/datamanagement/a/api/v4/applications?name=TEST_APP2&only_active=true"  -u superuser:suser

    Result is :

    [{"name":"TEST_APP2","id":"4"}]



    So application id for TEST_APP2 is 4

  2. Then execute this to find all environments associated to TEST_APP2 application :

    curl "http://nac_name:8080/datamanagement/a/api/v6/applications/4/environments?only_active=true"  -u superuser:suser

    Result is :

    [{"applicationName":"TEST_APP2","applicationId":"4","description":"Environment for Default Architecture","name":"Environment for Default Architecture","id":"3"},{"applicationName":"TEST_APP2","applicationId":"4","name":"Env_App2","id":"5"}]