Using the API client

The API client allows you to make API requests to all API Resources. This client is preconfigured to use the correct authentication and authorization options. It also automatically uses the company account. You can make a call by its resource name, for example Agent. The methods available are get, patch, post, options, put and delete, which correspond to the HTTP methods. The methods will return the response body as a Python Dict.

Making a get request on the Agent resource:

from ixoncdkingress.function.context import FunctionContext

@FunctionContext.expose
def hello_world(context: FunctionContext, **kwargs: dict[str, str]):
    context.api_client.get('Agent', {'publicId': 'RPHHg5LaTtQg'})

🚧

Access scopes

For security reasons, a deployed Cloud Function has an access token that can't send requests to API resources by default. Please contact support to request access to resources when needed. This constraint does not apply during local development.

Custom API Application

If you want to use your own API-Application credential, you must call set_custom_api_application before calling an endpoint. The example below sets the API application to 'MY-API-APPLICATION' and calls the Agent resource.

from ixoncdkingress.function.context import FunctionContext

@FunctionContext.expose
def hello_world(context: FunctionContext, **kwargs: dict[str, str]):
    context.api_client.set_custom_api_application('MY-API-APPLICATION')
    context.api_client.get('Agent', {'publicId': 'RPHHg5LaTtQg'})