Skip to content

Latest commit

 

History

History
442 lines (303 loc) · 13.4 KB

File metadata and controls

442 lines (303 loc) · 13.4 KB

stratum.APIKeysApi

All URIs are relative to http://localhost:3000

Method HTTP request Description
create_api_key POST /api/v1/api-keys Create API key
list_api_keys GET /api/v1/api-keys List API keys
list_dormant_api_keys GET /api/v1/api-keys/dormant List dormant API keys
revoke_api_key DELETE /api/v1/api-keys/{id} Revoke API key
rotate_api_key POST /api/v1/api-keys/{id}/rotate Rotate API key

create_api_key

ApiKeyCreated create_api_key(create_api_key_input)

Create API key

Create a new API key. The plaintext key is only returned once.

Example

  • Api Key Authentication (apiKey):
  • Bearer (JWT) Authentication (bearerAuth):
import stratum
from stratum.models.api_key_created import ApiKeyCreated
from stratum.models.create_api_key_input import CreateApiKeyInput
from stratum.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:3000
# See configuration.py for a list of all supported configuration parameters.
configuration = stratum.Configuration(
    host = "http://localhost:3000"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Configure Bearer authorization (JWT): bearerAuth
configuration = stratum.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with stratum.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = stratum.APIKeysApi(api_client)
    create_api_key_input = stratum.CreateApiKeyInput() # CreateApiKeyInput | 

    try:
        # Create API key
        api_response = api_instance.create_api_key(create_api_key_input)
        print("The response of APIKeysApi->create_api_key:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling APIKeysApi->create_api_key: %s\n" % e)

Parameters

Name Type Description Notes
create_api_key_input CreateApiKeyInput

Return type

ApiKeyCreated

Authorization

apiKey, bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Created API key with plaintext secret -
400 Validation error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_api_keys

List[ApiKey] list_api_keys(tenant_id=tenant_id)

List API keys

List API keys, optionally filtered by tenant.

Example

  • Api Key Authentication (apiKey):
  • Bearer (JWT) Authentication (bearerAuth):
import stratum
from stratum.models.api_key import ApiKey
from stratum.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:3000
# See configuration.py for a list of all supported configuration parameters.
configuration = stratum.Configuration(
    host = "http://localhost:3000"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Configure Bearer authorization (JWT): bearerAuth
configuration = stratum.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with stratum.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = stratum.APIKeysApi(api_client)
    tenant_id = UUID('38400000-8cf0-11bd-b23e-10b96e4ef00d') # UUID | Filter by tenant ID (optional)

    try:
        # List API keys
        api_response = api_instance.list_api_keys(tenant_id=tenant_id)
        print("The response of APIKeysApi->list_api_keys:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling APIKeysApi->list_api_keys: %s\n" % e)

Parameters

Name Type Description Notes
tenant_id UUID Filter by tenant ID [optional]

Return type

List[ApiKey]

Authorization

apiKey, bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 List of API keys -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_dormant_api_keys

List[ApiKey] list_dormant_api_keys(days=days)

List dormant API keys

List API keys that have not been used within the specified number of days.

Example

  • Api Key Authentication (apiKey):
  • Bearer (JWT) Authentication (bearerAuth):
import stratum
from stratum.models.api_key import ApiKey
from stratum.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:3000
# See configuration.py for a list of all supported configuration parameters.
configuration = stratum.Configuration(
    host = "http://localhost:3000"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Configure Bearer authorization (JWT): bearerAuth
configuration = stratum.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with stratum.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = stratum.APIKeysApi(api_client)
    days = 90 # int | Number of days of inactivity (optional) (default to 90)

    try:
        # List dormant API keys
        api_response = api_instance.list_dormant_api_keys(days=days)
        print("The response of APIKeysApi->list_dormant_api_keys:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling APIKeysApi->list_dormant_api_keys: %s\n" % e)

Parameters

Name Type Description Notes
days int Number of days of inactivity [optional] [default to 90]

Return type

List[ApiKey]

Authorization

apiKey, bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 List of dormant API keys -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

revoke_api_key

revoke_api_key(id)

Revoke API key

Revoke an API key, permanently disabling it.

Example

  • Api Key Authentication (apiKey):
  • Bearer (JWT) Authentication (bearerAuth):
import stratum
from stratum.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:3000
# See configuration.py for a list of all supported configuration parameters.
configuration = stratum.Configuration(
    host = "http://localhost:3000"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Configure Bearer authorization (JWT): bearerAuth
configuration = stratum.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with stratum.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = stratum.APIKeysApi(api_client)
    id = UUID('38400000-8cf0-11bd-b23e-10b96e4ef00d') # UUID | 

    try:
        # Revoke API key
        api_instance.revoke_api_key(id)
    except Exception as e:
        print("Exception when calling APIKeysApi->revoke_api_key: %s\n" % e)

Parameters

Name Type Description Notes
id UUID

Return type

void (empty response body)

Authorization

apiKey, bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
204 API key revoked -
404 API key not found or already revoked -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

rotate_api_key

ApiKeyCreated rotate_api_key(id, rotate_api_key_input=rotate_api_key_input)

Rotate API key

Rotate an API key, revoking the old one and issuing a new one.

Example

  • Api Key Authentication (apiKey):
  • Bearer (JWT) Authentication (bearerAuth):
import stratum
from stratum.models.api_key_created import ApiKeyCreated
from stratum.models.rotate_api_key_input import RotateApiKeyInput
from stratum.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:3000
# See configuration.py for a list of all supported configuration parameters.
configuration = stratum.Configuration(
    host = "http://localhost:3000"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKey'] = 'Bearer'

# Configure Bearer authorization (JWT): bearerAuth
configuration = stratum.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with stratum.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = stratum.APIKeysApi(api_client)
    id = UUID('38400000-8cf0-11bd-b23e-10b96e4ef00d') # UUID | 
    rotate_api_key_input = stratum.RotateApiKeyInput() # RotateApiKeyInput |  (optional)

    try:
        # Rotate API key
        api_response = api_instance.rotate_api_key(id, rotate_api_key_input=rotate_api_key_input)
        print("The response of APIKeysApi->rotate_api_key:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling APIKeysApi->rotate_api_key: %s\n" % e)

Parameters

Name Type Description Notes
id UUID
rotate_api_key_input RotateApiKeyInput [optional]

Return type

ApiKeyCreated

Authorization

apiKey, bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 New API key with plaintext secret -
404 API key not found or already revoked -

[Back to top] [Back to API list] [Back to Model list] [Back to README]