Review PaperCut on G2

Choose your language

Choose your login

Contact us

What are Client API Stubs?

API stubs are a set of source code files with type definitions and methods prototypes, but without implementation of these methods. Some developers find it easier to use these stubs rather than programming HTTP requests.

PaperCut provide an OpenAPI specification of the AOP APIs and you can use a code generator tool to create your own API stubs. There are a variety of tools that can consume OpenAPI V3, and this example is provided to help if you have not done this before.

Basic Process

  1. Download the OpenAPI YAML file (there is a download button on the API ref page)

The Download Button

  1. Run the your chosen code generator, making sure use the correct programming language for your client development. For example
npx @openapitools/openapi-generator-cli generate -g python -o client_stubs  -i public-bundle.yaml

In this example we are using the OpenAPI Generator (to be technically accurate we are using the NPM wrapper for the OpenAPI Generator). Other tools are available.

OpenAPI Generator tips

  1. OpenAPI Generator can generate code for a wide collection of languages. Run npx @openapitools/openapi-generator-cli list to review

  2. OpenAPI Generator has a large number of options to tune the output. Try running npx @openapitools/openapi-generator-cli help generate or consult the docs

  3. Running OpenAPI Generator via npx every time can be slow. You can install the wrapper locally or use a Docker image to save time.