Skip to main content Skip to complementary content

Working with API mocks

Enabling your API mock

Every Talend Cloud API Designer API version comes with an integrated API mock. Each version of an API has a unique mock endpoint. When you create a new version from an existing version with a mock enabled, the mock is disabled in the new version. You can enable it to get a new endpoint.

Procedure

  1. Go to the Settings page.
  2. Scroll down to the MOCK section, then toggle the Enabled button to On.
    MOCK section.
  3. Click Save.

Results

When you activate an API mock, the mock endpoint is added to your API, and is visible at the top of the left panel.

The Crawler API with the mock endpoint added to it.

This endpoint is also visible in API documentation that you publish from Talend Cloud API Designer.

Information noteNote: The first endpoint in the list of endpoints is selected when you use features like exporting OAS and trying your API in Talend Cloud API Tester. You can reorder endpoints at anytime via the general information panel.

Making calls to your API mock

Use Talend Cloud API Tester to make calls to your API mock.

The easiest way to start interacting with your API mock is to start making requests to it from Talend Cloud API Tester, the HTTP client and testing tool available as a Google Chrome extension.

Before you begin

  • You have enabled your API mock.
  • You have installed the Talend Cloud API Tester Google Chrome extension.

Procedure

  1. Open your API and go to Settings > MOCK.
  2. Click Try the mock in API Tester.
    MOCK configuration.

    You can also try individual operations by clicking Try in API Tester on any operation's page in the editor, or next to the operation's name in published documentation.

    Information noteTip: If you keep the mock endpoint as the first in the list of endpoints in your API contract, all use of the Try in API Tester feature opens Talend Cloud API Tester and creates requests that target your mock.

Results

The entire API opens as a new project in Talend Cloud API Tester.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!