Skip to content

Working with the Management System API

Users that are not familiar with how to work with APIs can find pointers here. This section covers how to generate client source code and basic steps on using calls and functions of the Management System API.

Generating client source code from the OpenAPI file

To easily generate a workable client that enables working with the Management System API according to the OpenAPI standard, follow the instructions below. While there are many other tools for generation, it is highly recommended to use the Swagger Editor.

  1. Right-click and save as management_system_api.json in the Swagger UI on the Management System API page.

    Download JSON

  2. Go to Swagger Editor.

  3. Select File > Import file in the navigation bar.

    Import file

  4. Open the management_system_api.json that was downloaded before. It takes Swagger Editor a couple of seconds to generate the result.

  5. Select Generate Client in the navigation bar.
  6. Select a language from the list.

    Generate client language

After a couple of seconds, a download will start for a ZIP file containing the generated client.

Trying out the Management System API

To try out the API in the Swagger Editor, a Management System and a user account in this Management System are required. Note that the user account needs admin permissions to use certain calls and functions. In case of no Management System being available, write an issue through the TTTech Industrial support portal.

  1. Right-click and save as management_system_api.json in the Swagger UI on the Management System API page.

    Download JSON

  2. Go to Swagger Editor.

  3. Select File > Import file in the navigation bar.

    Import file

  4. Open the management_system_api.json that was downloaded before. It takes Swagger Editor a couple of seconds to generate the result.

  5. Insert the following lines after line 11:

    12
    13
    14
    15
    16
    "servers": [
      {
        "url": "<managementsystemURL>"
      }
    ],
    

    This will make a drop-down menu appear in the generated output on the right side.

    Enter server URL

    Note

    Replace <managementsystemURL> with the actual URL of the Management System.

  6. Expand POST /auth/login under USER on the right side.

  7. Select Try it out.

    Try user login

  8. Select the text field.

  9. Enter the following information:

    Item Description
    identity Enter the user name of the account used to log in to the Management System.
    secret Enter the password of the account used to log in to the Managment System.

    Enter user account information

  10. Select Execute. A response from the server will pop up below the Execute button.

  11. Look for sessionId in the server response.

    Copy sessionId

  12. Copy the value next to sessionId.

    Note

    Take note to only copy the numeric value without quotation marks.

  13. Select Authorize at the top of the screen. A new window will appear.

    Select Authorize

  14. Paste the session ID value into the Value field under sessionId (apiKey).

    Paste session ID value

  15. Select Authorize.

  16. Select Close to close the window.

The user is now authenticated and successfully logged in. Functions can now be experimented with. As a demonstration, follow the instructions below to fetch a list of Docker workloads provisioned in the Management System.

  1. Expand GET /nerve/v3/workloads under WORKLOAD_v3.

    Expand GET /nerve/v3/workloads

  2. Select Try it out.

  3. Select the drop-down menu next to fType string (query).
  4. Select docker from the drop-down menu.

    Select docker

  5. Select Execute.

    Select Execute

A response from the server will pop up below the Execute button, presenting a list of Docker workloads available in the Management System.

Check server response