Adding More APIs to Existing Projects

In most cases, your ReadyAPI project contains at least one API, but you can add more if needed.

There are three main ways to add an API to the project:

go.gifImport from Definition

Use an API definition (Swagger/OpenAPI, GraphQL, AsyncAPI, gRPC and so on) to add an API to the project. You can import an API from a local file, URL address, or directly from SwaggerHub.

go.gifCreate API Definition

You create a REST or Kafka API from scratch.

go.gifDiscover API

You add an API by recording requests while you are working with the service.

Import from Definition

To import API from the definition:

  • Click flyout-ellipsis.pngnext to the APIs node and select Import API Definition:

    API testing: Add APIs flyout menu

    — or —

    Right-click the APIs section in the Navigator and select Import API Definition.

    API testing: Add APIs menu item
  • Use the Import API Definition dialog to import the definition:

    Tab

    Description

    My Computer or URL

    Import the definition from a definition file: Swagger/OpenAPI, GraphQL, AsyncAPI (Kafka), gRPC, WSDL, or WADL.

    SwaggerHub

    Import the definition from SwaggerHub.

    OAS 3.1

    Displays OpenAPI Specification version 3.1 definitions.

Note

Some special characters like {,} will be replaced in automatically generated test case names derived from request URLs. This is because of compatibility issues with Groovy scripts.

Import from file

To import an API from a definition file, specify the path to a local file, or its URL in the Source field and click Import API:

Add API to ReadyAPI project

ReadyAPI defines the definition type automatically. If you need to specify advanced options, select the needed type manually from the Type drop-down list.

Below, you can find descriptions of the Advanced options for different definition types:

Swagger/OpenAPI Definition (REST)

  • Default Media Type - Specifies the media type that ReadyAPI will use for the requests in which no media type is specified.

Important

When you load a large definition, ReadyAPI may fail to save the project because of the lack of Java heap space. To fix the issue, you can disable creating request samples.

GraphQL schema

WSDL Definition (SOAP)

  • Create sample requests for all operations - Creates sample requests for all WSDL operations.

    Adding WSDL definition to ReadyAPI: Generated sample request
  • Create a test case for the imported WSDL - Generate test cases for each operation in WSDL.

  • Create a virtual service for the imported WSDL - Creates a virtual API based on the imported WSDL.

WADL Definition (REST)

  • Create a test case for the imported WADL - Select this option if you want ReadyAPI to generate test cases

AsyncAPI Definition

There are currently no advanced options for AsyncAPI definitions.

gRPC Definition

There are currently no advanced options for gRPC definitions.

Import from SwaggerHub

Important

ReadyAPI supports SwaggerHub SaaS and SwaggerHub On‑Premise 1.23.0-46 or later.

Use the SwaggerHub tab to import public or private definitions from SwaggerHub:

  1. Select a definition or definitions that you want to add to your project.

    Create project from SwaggerHub: Select definitions
    • My API contains APIs created by or shared with the SwaggerHub account that you have added to ReadyAPI. If you haven't added an account, click Log In to SwaggerHub.

    • Public API contains all the APIs in SwaggerHub that you have access to.

    Tip

    Use search and filter functionality to find the APIs you need.

  2. Select versions of definitions that will be imported. The default version (marked with swaggerhub-default-version.png) of the definition is selected by default:

    Create project from SwaggerHub: Select version
  3. Click Import API.

You can also publish your API definition to SwaggerHub or SwaggerHub On-Premises. See Export to SwaggerHub for details.

SwaggerHub connection issue

If you cannot connect to SwaggerHub using your credentials, try regenerating API keys in SwaggerHub:

  1. Open the account settings in SwaggerHub:

    SwaggerHub integration: Account settings
  2. Switch to the API Keys tab and click Regenerate:

    SwaggerHub integration: Regenerating API keys
  3. Edit your SwaggerHub account info in ReadyAPI and enter the new API key:

    SwaggerHub integration: Edit account info

Important

Please note that, if you use these keys to access SwaggerHub’s public API, you need to update them in your code, as well.

Import GraphQL API from Introspection Query

You can directly import the GraphQL API from the running service by providing the URL of the GraphQL endpoint. There's no requirement for a file with a predefined schema.

  • To import, determine the URL of the GraphQL endpoint. By default, the endpoint is set to "/graphql."

    add-graphql-url.webp
  • Ensure that the introspection query is enabled on the server. This is necessary for automatic schema creation.

  • The schema will be generated automatically based on the provided URL and the enabled introspection query.

    add-graphql-schema.webp
  • The URL of the GraphQL endpoint will be added to the API definition.

    add-graphql-endpoint.webp

Create API Definition (For REST and Kafka services)

  1. Click flyout-ellipsis.pngnext to the APIs node and select Create API Definition:

    API testing: Creating API definition via flyout menu

    — or —

    Right-click the APIs section in the Navigator and select Create API Definition.

    API testing: Creating API definition via context menu
  2. Specify the name of the API and protocol and click Create API:

    API testing: The Create API definition dialog

    To learn how to populate the newly created API, see Managing REST APIs and Managing Kafka APIs.

Other ways to add APIs

New XML-RPC service from URL

To add an XML-RPC service to your project:

  1. Right-click the APIs node and select New XML-RPC Service from URL:

    SwaggerHub in ReadyAPI: Importing SwaggerHub definition
  2. In the subsequent dialog, enter your service .rem URL:

    Adding the new XML-RPC Service from URL
  3. To create sample requests, select Create Requests.

  4. Click OK.

See Also

Publication date: