Software Secure Workload
Activity Configure

OpenAPI Authentication

OpenAPI uses a digest-based authentication scheme. The workflow is as follows:

  1. Log in to the Secure Workload UI Dashboard.

  2. Generate an API key and an API secret with the desired capabilities.

  3. Use Secure Workload API SDK to send REST requests in JSON format.

  4. To use the Python SDK, you install the SDK using pip install tetpyclient.

  5. After the Python SDK is installed, here is some boilerplate code for instantiating the RestClient:


    from tetpyclient import RestClient

    API_ENDPOINT="https://<UI_VIP_OR_DNS_FOR_TETRATION_DASHBOARD>"

    # ``verify`` is an optional param to disable SSL server authentication.
    # By default, cluster dashboard IP uses self signed cert after
    # deployment. Hence, ``verify=False`` might be used to disable server
    # authentication in SSL for API clients. If users upload their own
    # certificate to cluster (from ``Platform > SSL Certificate``)
    # which is signed by their enterprise CA, then server side authentication
    # should be enabled; in such scenarios, in the code below, verify=False
    # should be replaced with verify="path-to-CA-file"
    # credentials.json looks like:
    # {
    #   "api_key": "<hex string>",
    #   "api_secret": "<hex string>"
    # }

    restclient = RestClient(API_ENDPOINT,
                    credentials_file='<path_to_credentials_file>/credentials.json',
                    verify=False)
    # followed by API calls, for example API to retrieve list of agents.
    # API can be passed /openapi/v1/sensors or just /sensors.
    resp = restclient.get('/sensors')