Skip to main content
Skip table of contents

Generating client libraries via OpenAPI

Soteri’s Scanning Service publishes an OpenAPI 3.0 Schema at https://api.soteri.io/api-schema.

You can interactively browse this schema here.

Generating API Clients

You can use OpenAPI Generator to generate API client libraries in a variety of languages.

Install OpenAPI Generator

See the OpenAPI Generator README. On mac, you can use homebrew:

BASH
brew install openapi-generator

Generate a client library of your preferred language

To generate a client (for example, with python):

BASH
openapi-generator generate -i https//api.soteri.io/api-schema -g python -o soteri-api-client

The generated client has a README, which includes examples of how to use the client library. For example, the generated python client would be used like this:

PY
import time
import openapi_client
from openapi_client.api import scanning_api_api
from openapi_client.model.overall_response import OverallResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.soteri.io
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
    host = "https://api.soteri.io"
)


# Enter a context with an instance of the API client
with openapi_client.ApiClient() as api_client:
    # Create an instance of the API class
    api_instance = scanning_api_api.ScanningAPIApi(api_client)
    include_allowlisted = False # bool | If true, include allowlisted findings. (optional) if omitted the server will use the default value of False
    file = [
        open('/path/to/file', 'rb'),
    ] # [file_type] | The files to be scanned. (optional)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        api_response = api_instance.scan(include_allowlisted=include_allowlisted, file=file)
        pprint(api_response)
    except openapi_client.ApiException as e:
        print("Exception when calling ScanningAPIApi->scan: %s\n" % e)
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.