HOPEX Power Studio > Using APIs > HOPEX Web Service API > Requesting connection Information
Requesting connection Information
Activate Connection Information service
To get environment id and repository id for the next steps, you will need to activate this web service. It is not not available by default to prevent security issues.
To activate the Connection Information service:
1. Access the HOPEXAPI web.config file.
2. Set the ActivateEnvs_Dbs variable to true.
Authentication
All requests must contain authentication information in the headers part of the http request.
The authorization header must respect one of the following format:
Authorization Type
Value
UAS
Bearer <uasToken>
Authorization type: UAS
Prerequisite: to use a token with UAS integration, you must get it before calling it and pass it in your header as a Bearer token.
1. Call UAS to get a token.
2. Retrieve the token.
3. Call the service with Bearer as Authorization scheme.
Environment list
Getting the environment id using megasite.ini
To get the list of environments installed on the server:
1. Access the megasite.ini file, stored in the following folder:
\{HOPEX Path}\Cfg\megasite.ini
2. In the Environment Shortcuts section, note the environment Hexaidabs:
For example: B2D7B1R75C4A7F40
[Environment Shortcuts]
B2D7B1R75C4A7F40=(C:\MEGA\HOPEX %RELATIVEDIR%\Environments\...
3. Convert the hexa idabs (16 char) (e.g. B2D7B1R75C4A7F40) into the cn64 idabs (12 char) format. To do that, use the MegaIDConverter.exe tool avalaible in the following folder:
\{HOPEX Path}\Utilities\HOPEX Server Supervisor\MegaIDConverter.exe
Getting the environment id using connection information service
To fetch the list of environments:
1. Call the URL:
{WEBSERVICEURL}/environments
2. You need a UAS token and pass it through the header of your request.
For example:
Authorization:Bearer 33b2200fb17f0a5ebce89b1cee63f66c
According to your Accept header key value, it returns you:
* an XML message:
*a Json message:
 
 
The system returns a list of environments.
Property
Description
Id
Identity of the environment
Name
Name of the environment
Repository list
Getting the repository id using megasite.ini
To get the list of repositories installed on the server:
1. Access the MegaEnv.ini file, stored in the following folder:
\{HOPEX Environment Path}\Environments\<Environment name>\
2. In the [DbReferences] section, note the Hexaidabs of each repository:
For example: 80CBA9F15C6C190C for repository “EA” and 80CBAD2C5C6CCAC7 for repository “SOHO”
[DbReferences]
80CBAD2C5C6CCAC7=(\{HOPEX Environment Path}\Environments\<Environment name>\Db\SOHO\SOHO.emq
3. Convert the hexaidabs (16 char) (e.g.: 80CBA9F15C6C190C) into the cn64 idabs (12 char) format. To do that, use the MegaIDConverter.exe tool, available in the following folder:
\{HOPEX Path}\Utilities\HOPEX Server Supervisor\
 
 
Getting the repository id using connection information service
To fetch the list of repositories:
1. Call the URL:
{WEBSERVICEURL}/environments/{env_id}/repositories
Where {env_id} is the environment id.
According to your Accept header key value, it returns you:
* an XML message:
*a Json message:
The system returns an environment name with a list of Hopex repositories.
Property
Description
Bases
The list of Hopex repositories
Id
Identity of the repository
Name
Name of the repository
Name
The name of the environment