6. API endpoints - Environment endpoints 

Page / - last modified by Outhman Moustaghfir on 2021/11/22 12:33 

Environment endpoints 
last modified by Outhman Moustaghfir
on 2021/11/22 12:33

Table of Contents
Introduction :
Endpoints :

Introduction :
This section will describe in detail how to manage the Environment entity.
Endpoints :
URL [method]	Description	Input example	Output example	
/rest/environments [GET]	Get a list that contains the current environment and its sub-environments. 	(no input required)	{
   "timestamp": 1637580872193,
   "status": "200",
   "data": [
        {
           "envid": 20,
           "parent": 19,
           "alias": "TestEnv1",
           "code": "",
           "sendurl": false,
           "active": true,
           "timezone": "GMT",
           "gitRepository": ""
        },
        {
           "envid": 19,
           "parent": 1,
           "alias": "greatEnv",
           "code": "122",
           "sendurl": false,
           "active": true,
           "timezone": "GMT",
           "gitRepository": ""
        },
        {
           "envid": 1,
           "parent": 1,
           "alias": "iXPath",
           "code": "",
           "sendurl": false,
           "active": true,
           "timezone": "Europe/Paris",
           "gitRepository": ""
        },
        {
           "envid": 25,
           "parent": 1,
           "alias": "PAR",
           "code": "",
           "sendurl": false,
           "active": true,
           "timezone": "GMT",
           "gitRepository": ""
        },
        {
           "envid": 26,
           "parent": 25,
           "alias": "PARR",
           "code": "",
           "sendurl": false,
           "active": true,
           "timezone": "GMT",
           "gitRepository": ""
        }
    ]
}	
/rest/environments/{id} [GET] 	Get an environment object by id.	The {id} bracket should be replaced by the environment's ID	{
   "timestamp": 1637587579297,
   "status": "200",
   "data": {
       "envid": 1,
       "parent": 1,
       "alias": "iXPath",
       "code": "",
       "sendurl": false,
       "active": true,
       "timezone": "Europe/Paris",
       "gitRepository": ""
    }
}	
/rest/environments/byAlias/{alias} [GET] 	Get an environment object by alias.	The {alias} bracket should be replaced by the environment's alias.	{
   "timestamp": 1637587579297,
   "status": "200",
   "data": {
       "envid": 1,
       "parent": 1,
       "alias": "iXPath",
       "code": "",
       "sendurl": false,
       "active": true,
       "timezone": "Europe/Paris",
       "gitRepository": ""
    }
}	
/rest/environments/childs/{id} [GET] 	Get children list of a certain environment by ID.	The {id} bracket should be replaced by the environment's id	if by example, the env "iXPath" with EnvID=1 has 2 children : "greatEnv" and "PAR" , the returned object will be  : 
{
   "timestamp": 1637587991054,
   "status": "200",
   "data": [
        {
           "envid": 19,
           "parent": 1,
           "alias": "greatEnv",
           "code": "122",
           "sendurl": false,
           "active": true,
           "timezone": "GMT",
           "gitRepository": ""
        },
        {
           "envid": 25,
           "parent": 1,
           "alias": "PAR",
           "code": "",
           "sendurl": false,
           "active": true,
           "timezone": "GMT",
           "gitRepository": ""
        }
    ]
}	
/rest/environments/folder/{alias} [GET]	Create all folders needed for the environment. 	The {alias} bracket should be replaced by the environment's alias.	 {
   "timestamp": 1637587991054,
   "status": "200",
   "data": "OK"
 }	
/rest/environments [POST]	Create a new environment in the database	  {
 "alias" : "eud",
 "parent" : 1,
 "active" : true,
 "code" : "ADE",
 "sendurl" : true,
 "timezone" : "GMT",
 "gitRepository" : null
   }
 
NB: "alias", "parent" and "active" are mandatory fields.
 	{
   "timestamp": 1637590549094,
   "status": "200",
   "data": {
       "envid": 37,
       "parent": 1,
       "alias": "eud",
       "code": "ADE",
       "sendurl": true,
       "active": true,
       "timezone": "GMT",
       "gitRepository": null
    }
}	
/rest/environments/parents/{id}	Get the ascendant hierarchy of a certain environment by id.	The {id} bracket should be replaced by the environment's ID	suppose that we have an env with EnvID=27, and its has EnvID = 26, the returned response will look like below :
 {
   "timestamp": 1637591546553,
   "status": "200",
   "data": [
        {
           "envid": 26,
           "parent": 25,
           "alias": "PARR",
           "code": "",
           "sendurl": false,
           "active": true,
           "timezone": "GMT",
           "gitRepository": ""
        },
        {
           "envid": 25,
           "parent": 1,
           "alias": "PAR",
           "code": "",
           "sendurl": false,
           "active": true,
           "timezone": "GMT",
           "gitRepository": ""
        }
    ]
}