Generate a Client SDK

You can generate full-featured RESTful API clients with our OpenAPI Spec by using any third-party OpenAPI specification-compliant code generators, such as OpenAPI Generator (recommended). You only need to update the specification with our new or modified endpoints and quickly generate client SDK in various programming languages. This document provides an example of leveraging the openAPI generator to customize and streamline API development. You can also generate client SDKs using Swagger Codegen, Swagger Editor, and Swagger Hub as shown in subsequent sections.

Prerequisites

OpenAPI Generator

For steps to get started, refer to OpenAPI Generator.

JAR File

Note down the location of the openapi-generator-cli.jar file.

Optum OpenAPI Spec

  1. Copy the URL for the required OpenAPI specification, for example, for the Professional Claims V3 Getting Started page.
2990

Eligibility V3 API Getting Started Page

  1. To copy the link (https://developer.optum.com/eligibilityandclaims/openapi/60352a6f7e12f500829d5bbe), right-click the Download OpenAPI Spec as highlighted in the preceding figure.

Optionally, you can download the OpenAPI Spec locally and view the specification by clicking the Download OpenAPI Spec button.

Generate a client SDK using the OpenAPI generator

This is a client SDK example in Java.

  1. Enter the location of the openapi-generator-cli.jar marked within the angle brackets in the following example and run the command at the command prompt.
java -jar <location of (openapi-generator-cli.jar)> generate \
   -i https://developer.optum.com/eligibilityandclaims/openapi/627c2f20535bfe0014015fb9 \
   -g java \
   -o output

Parameter definitions

ParameterDescription
java -jarJAR, as per this example, openapi-generator-cli.jar
-iPath to the OpenAPI Spec (copied as shown in section)
-lDesired language to generate the API code in
-oOutput folder for the code to be generated
2210

Example of generated Java client SDK

  1. View the generated code in the output folder.
  2. Build your project using the generated Optum API code.

Optional ways to generate the client SDK

Generate a client SDK using Swagger Codegen

  1. Copy the Optum OpenAPI Spec.
  2. Get started with Swagger-Codegen.
  3. Run the following command at the command prompt (the following example uses swagger-codegen-cli-3.0.35.jar):
```
java -jar swagger-codegen-cli-3.0.35.jar generate /
-i https://developer.optum.com/eligibilityandclaims/openapi/60352a6f7e12f500829d5bbe /
-l java /
-o out 
```

See parameter definitions

1514

Example of generated Java client SDK

  1. View the generated code in the output folder.
  2. Build your project using the generated Optum API code.

Using Swagger Hub

  1. Follow the instructions to create an Swagger Hub account.
  2. Click Create New >> Create New API.
  3. Select these fields:
  • Specification: OpenAPI 3.0.0
  • Template: None
  • Name: API name, for example, Medical_Client_SDK
  • Version: For example, V1
  1. Open the downloaded Optum OpenAPI Spec in an editor of your choice and to copy all the content of the file.
  2. Paste the copied OpenAPI Spec content in the Swagger Hub editor window to paste the copied content to view the API output as shown here:

  1. On the top-right corner, click Export, and then select Client SDK as marked in the preceding figure.
    This downloads the API code locally, which you can use to build your project.

Generate a client SDK using Swagger Editor

  1. Go to Swagger Editor.
  2. Click File >> Import File and select the downloaded Optum OpenAPI Spec.
    The API output appears as shown here:

  1. Click Generate Client and select the language, for example, java as indicated in the preceding figure.
    This downloads the API code locally, which you can use to build your project.

Related topics

  • Try our APIs using our API collection in Postman or using our interactive documentation's Try It interface.