Skip to content

Latest commit

 

History

History
53 lines (31 loc) · 2.38 KB

File metadata and controls

53 lines (31 loc) · 2.38 KB

Serviceware

Generating an API Client

The Serviceware Knowledge REST API is described by an OpenAPI specification. Code-generation tools can read this specification and produce a fully typed client library in the language of your choice, saving you from writing boilerplate HTTP and serialization code by hand. The generated client gives you typed method signatures, request/response models, and compile-time safety for every API operation.

Obtaining the OpenAPI Specification

Download the specification from your Knowledge instance:

https://<your-instance>/sabio-web/services/api-docs

The endpoint returns the specification as a YAML document. Save it to a local file for use with the code generator:

curl -o knowledge-api.yaml https://<your-instance>/sabio-web/services/api-docs

Generating a Client

Swagger Codegen is the recommended tool for generating client libraries from the OpenAPI specification.

Java

swagger-codegen-cli generate -i knowledge-api.yaml -l java -o ./generated-client

This produces a Maven project under ./generated-client containing model classes, API interfaces, and a pre-configured HTTP client.

Python

swagger-codegen-cli generate -i knowledge-api.yaml -l python -o ./generated-client

This produces a Python package under ./generated-client with typed models and API client classes.

Other Languages

Swagger Codegen supports many additional languages and frameworks, including C#, TypeScript, Go, Ruby, and more. Refer to the Swagger Codegen documentation for the full list of supported targets and configuration options.

Authentication

The generated client handles request and response serialization, but it does not configure authentication headers automatically. You must set up authentication separately before making API calls.

Note: Refer to the Authentication guide for details on how to authenticate your requests using session tokens, API keys, or OAuth2 bearer tokens.

Next Steps

  • Authentication -- Learn how to authenticate API requests against your Knowledge instance.