Hacarus.SpectroSdk.TokenApi

All URIs are relative to https://sdd-api-staging.hacarus.com

Method HTTP request Description
login POST /api/auth/token Authorization

login

LoginResponse login(login_params)

Authorization

Returns the access token

Example

import time
import Hacarus.SpectroSdk
from Hacarus.SpectroSdk.api import token_api
from Hacarus.SpectroSdk.model.login_params import LoginParams
from Hacarus.SpectroSdk.model.base_error import BaseError
from Hacarus.SpectroSdk.model.login_response import LoginResponse
from pprint import pprint
# Defining the host is optional and defaults to https://sdd-api-staging.hacarus.com
# See configuration.py for a list of all supported configuration parameters.
configuration = Hacarus.SpectroSdk.Configuration(
    host = "https://sdd-api-staging.hacarus.com"
)

# 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 Bearer authorization (JWT): jwt
configuration = Hacarus.SpectroSdk.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)

# Configure OAuth2 access token for authorization: oauth2
configuration = Hacarus.SpectroSdk.Configuration(
    host = "https://sdd-api-staging.hacarus.com"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# Enter a context with an instance of the API client
with Hacarus.SpectroSdk.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = token_api.TokenApi(api_client)
    login_params = LoginParams(
        client_id="client_id_example",
        client_secret="client_secret_example",
        grant_type="grant_type_example",
    ) # LoginParams | 

    # example passing only required values which don't have defaults set
    try:
        # Authorization
        api_response = api_instance.login(login_params)
        pprint(api_response)
    except Hacarus.SpectroSdk.ApiException as e:
        print("Exception when calling TokenApi->login: %s\n" % e)

Parameters

Name Type Description Notes
login_params LoginParams

Return type

LoginResponse

Authorization

jwt, oauth2

HTTP request headers

HTTP response details

Status code Description Response headers
200 Successful login -
401 Invalid credentials -
0 default error handler -

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