9.6.2. Using an API endpoint

9.6.2.1. Introduction

This procedure explains how to:

  • run an endpoint locally

  • retrieve the response

  • obtain the corresponding .json file

  • identify the response template and obtain an example of it

By clicking on the `Try it out` button, it is possible to test the selected query. The tool will also generate queries for you to use with curl.

The Procedure to execute an endpoint shows how to use the swagger graphical interface to select an API, execute the query, retrieve the response and the query curl.
However, this query inherits the rights, and therefore the token, of the query creator.
To run a query with different rights, see the Procedure for changing the token related to the request.

9.6.2.2. Prerequisites

User: member of Administrators Group


9.6.2.3. Preliminary operations


9.6.2.4. Procedure for accessing the GBox API

../../_images/BARRE_TITRE_OPERATOR.PNG
  • Click the (3) `API` button on the title bar,
    The following screen is displayed.
    ../../_images/GBOX-API-01.PNG

9.6.2.5. Procedure to execute an endpoint

To illustrate this example, the API chosen is that which enables analysis templates to be listed.

  • Select the `templates` theme from the list of existing themes (5).

  • Click on the API `GET/templates/ (Operators, Administrators) List and filter the templates`.
    The window below is displayed.
    ../../_images/GBOX-API-02.PNG

Note

For the example, the `/templates` endpoint was chosen.
Reminder: the purpose is to list and filter existing templates.

Astuce

Some endpoints require parameters to be entered before they can be run.

  • Click on button (2) `Try it out`.
    The window is modified ...
    ../../_images/GBOX-API-08.PNG
  • Click on the button (1) `Execute`.
    The query is launched and the following window is displayed.
    ../../_images/GBOX-API-07.PNG
    This window has several sections:
    • The `Curl` display area (1) for the Curl query

    • The `URL` display area (2) for the URL request

    • The `Server response` zone (3):

      • The return `Code` (4):
        • If the value of the code is `200 then the execution was successful.

        • If the message `code 400 Undocumented Error Bad Request` is displayed, check whether the mandatory parameters were entered correctly.

      • The body of the response (5): please refer to the presentation of the Overview of the API GBOX interface
      • The area describing the response header(6)
      • The request duration value in ms (7)
      • The `Download` button (8) to download the corresponding .json file
      ../../_images/GBOX-API-09.PNG
    • Zone (9) `Responses`.
      This zone displays different information depending on whether the `Model` or `Example Value` link (10) is used.
    • Either the output template (`Model`) in field (11): see Overview of the API GBOX interface

    • Or an example of the expected response in field (11) with example values (`Example Value`): see Overview of the API GBOX interface presentation
      The values are:
      • For type integer (value 0)

      • For type string (value = string)

      • For type boolean (value = true)

    Note

    The screenshot shows an example.