‎16-03-2023 10:39 AM - edited ‎16-03-2023 11:28 AM
Starting from HOPEX V5 the method for authentication for API has evolved.
Former Bearer Token is not available in V5. Oauth2 Authentication is not supported for the moment for API calls.
Depending on the use case you want to use the API you may use one or the other authentication method. Regardless of the chosen authentication methods the others headers and body information will remain the same.
The basis Auth allow you to access the API directly with credentials : loing/password.
curl --location --request POST 'httpx://www.myserver.com/HOPEXGraphQL/api/ITPM' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic V2Vic2VydmljZTpIb3BleA==' \
--data-raw '{"query":"query {\n application {\n id\n name\n cloudComputing\n }\n}","variables":{}}'
This authentication method is useful when you need to check identity and get the data with a login/password logic. It is nonetheless less secure than an API Key.
You need to create a dedicated User/Password within the HAS console to be able to use it in API Call. This user can be :
Process step :
You can now use this login/password for API call.
To access the API with an API Key you need to create it and defined all the technical information.
Once you will have defined this information the system will give you the API key. this API Key can be valid for all time or have a validity period.
The API Key generate does not contains any information that can be decrypted or decoded.
It is recommended Authentication methods whenever possible. It is ideal when scripting, when developing external app or when doing integration with external tools.
Now you can make call to any endpoint.
curl --location 'https://w-ogd/HOPEXGraphQL/api/ITPM' \
--header 'x-api-key: 5snybEHxGR8uTRAks2ySEgYs8t82rQ6KqkrcEsp9srw737WmPZcJvpk1gNctBCjVQZvBwrryaFzJkHk61Q1eFJex' \
--header 'Content-Type: application/json' \
--data '{"query":"query\n{\n application\n {\n id\n name\n }\n}","variables":{}}'
You need to create a dedicated API Key within the HAS console to be able to use it in API Call. This API Key can be :
Process step :
You can now use this login/password for API call.
Caution :
This mode will change the behaviour in the back-end to process the request. When to choose which one :
Multi : for all purposes where you need responsiveness in the API calls.
Single : for heavy computing treatment. Ideal for heavy batch or static website generation
Solved! Go to Solution.
‎09-08-2023 04:19 PM
Hello @pgunna ,
The Expiration date has no effect on the session timeout. Expiration Date will cause the created API key to stop working after the input date. Sessions can be created and closed at any point during that time window.
Any open session has a time limit of x-minutes (20 by default, can be set in options). If this option is changed, it will affect all sessions.
https://doc.mega.com/hopex-v5-en/#page/SUPW/Gerer_les_options_Web.Options_Overview.html#ww1305764
I hope that this helps.
Kind regards,
Ryan
‎09-08-2023 03:22 AM
When we don't specify Expiration date for API Key, how long does the session (Instance) stays active? We are using API Key to connect to Hopex, we are running into issues with high CPU utilization on the session that uses API Key to connect on some days. When does the session expire or timeout if there is no expiration date specified.
‎02-06-2023 04:14 PM
URL shows not valid with or without the port, I am not sure what should be the correct URL and I don't see hopexgraphql web.config in the .shadowfiles on the HAS server under port 5000. I can see these modules on the HAS console, RestAPI, Graph QL show as ready.
http://ddddd0.hosts.cloud.ford.com:5000/hopexgraphql/home/index/ITPM
http://XXXXXX.hosts.cloud.ford.com:5000/hopexgraphql/home/index/ITPM
http://XXXXXX.hosts.cloud.ford.com/hopexgraphql/home/index/ITPM
http://XXXXXXX.hosts.cloud.ford.com/hopexgraphql/api/itpm
‎02-06-2023 04:07 PM
Under which folder on the HAS server is the web.config located that would contain the environment id, repository, webservice id. The environment ID and repository ID, profile and user are correct on the database.
‎02-06-2023 02:48 PM
Try the query without the port number, I do not think it is needed.
Hope that helps.
Kind regards,
Ryan
‎02-06-2023 08:35 AM
Hi,
I see "415 Unsupported Media Type" error in your first screenshot. Could you please check the parameters you set for the environment again?
‎01-06-2023 05:20 PM
It will be difficult to help over the forums. You should get in contact with MEGA Professional services to see more in details.
‎01-06-2023 05:18 PM
Before I click on save, I see person, profile and repository. But once I save when i open it, those 3 values are not there any more. I tried creating a new user but I still see the same scenario
‎01-06-2023 03:05 PM
You did not get my point you should not see "Person" drop down". Because you see it it tells me your HOPEX user is not properly configure. Create a new one and adjust it's configuration
‎01-06-2023 03:03 PM
I am not sure why person and profile are empty, I had selected contributor profile when I created this. In V4 on the server there is a web.config that has the schedule, web services user and password. Where is the web.config for GraphQL that includes the standard graphql modules.