8.6.10. Using an endpoint API
8.6.10.1. Introduction
This procedure shows how:
Run an endpoint locally
Retrieve the answer
Have the corresponding .json
Know the model of the response and have an example of it
`Try it out`
button, it is possible to test the selected query and the tool generates the query to use with curl.8.6.10.2. Prerequisites
User : member of Administrator group
8.6.10.3. Preliminary operations
Login to GCenter via a browser (see Connecting to the GCenter web interface via a web browser).
8.6.10.4. Procedure to acces to API
- Click on the button (4)
`API`
in the title bar.The following screen is displayed.
8.6.10.5. Procedure to run an endpoint
To illustrate this example, the API chosen is the one that lists the GCaps connected to GCenter.
Select the
`Gcaps`
theme from the list of existing themes (5).- Click on the API
`GET/api/gcap/ (Administrators, Operator) Get all the GCaps linked to the GCenter`
.The window below is displayed.Astuce
For some endpoints, it is mandatory to enter parameters before running it.
- Click on the button (2)
`Try it out`
.The window is changed ... - Click on the button (1)
`Execute`
.The request is launched and the next window is displayed.This window has several zones:The display zone (2)
`Curl`
for the Curl queryDisplay zone (3)
`URL`
for URL requestZone (4)
`Server response`
:- The Return
`Code`
(5):If the code is set to
`200`
then the execution has been completed correctly.If the message
`code 400 Undocumented Error Bad Request`
is displayed, verify that the required parameters are entered.
- The body of the answer (6): refer to Overview of the API interface
- The field detailing the answer header (7)
- The value in ms of the query duration (8)
- The
`Download`
button to download the corresponding .json file
- The
`Responses`
zoneThis zone displays different information depending on the use of the link`Model`
or`Example Value`
. Or the output model (
`Model`
): refer to Overview of the API interface- An example of the answer in the expected field with values for example (
`Example Value`
): refer to Overview of the API interfaceThe values are:For integer type (value 0)
For type string (value = string)
For boolean type (value = true)
8.6.10.6. Procedure to modify the token associated with the request
- Click the button (1).The
`Available authorizations`
window is displayed:There are two options:
Or the use of an apikey (token previously created)
Or the use of an authorization by name and password of an account previously created
To use an apikey (token previously created):
Paste the token in the
`value`
fieldValidate by clicking on the
`Authorize`
fieldClose window with the
`Close`
fieldNote
The token can have a limited life: see The `API Keys` section of the `Accounts` submenu.
To use an authorization:
Click in the`Username
fieldThe list of existing accounts is displayed.Enter the account password
Validate by clicking on the
`Authorize`
fieldClose window with the
`Close`
field