Testing a running API flow

When you create an API flow in your App Connect Designer instance, the definition provides an API that you can expose. After you start the flow, you can verify its behavior by using the built-in test facility to call the endpoints for each of the implemented API operations.

Tip: While developing a flow, you can also test (or try out) the flow or individual actions before you start the flow. For more information, see Testing a non-running flow with sample data.

Before you begin

You must have created a flow by using one of the methods for creating flows for an API, and then started the flow.

Procedure

To test a running flow in your App Connect Designer instance, complete the following steps:

  1. If the flow is not already open, click Dashboard in the navigation pane and then click the flow tile.
    Define tab for a running API flow
  2. Click the Test tab.

    The Overview page displays the API type and the base URL for the API endpoint. To the right of the Overview title, a tag is provided for each model that is defined in the API flow.

    A Download Open API Document link is also provided for the OpenAPI document that describes the API. If you download this document, it is saved as a YAML file to the default download location that is configured for your browser. The format of the file name is flowName-version.yaml; for example, Customer API-1.0.0.yaml. The version number is derived from the version of the API in the OpenAPI document, and is always set to 1.0.0.

    Overview page for the API

    The left pane provides a Filter menu and lists the operations that are implemented for the API flow, and the model definitions. You can use the Filter menu to change how the operations are labeled or grouped in this pane. (The operations can be grouped by model name.)

    Filter menu

    From the left pane, you can click each operation to view its details and test the behavior. Notice that the tag shown will reflect the model that an operation belongs to.

    For each operation, the Details tab displays the following information:
    • The HTTP method and request for the operation.
    • The authentication method (security scheme) that the API uses.
    • The header parameters in a collapsible section.
    • The body, path, or query parameters with examples, and the schema if relevant, in collapsible sections. The parameters that you see will depend on the operation's settings.
      Security mechanism, and HTTP request and parameters for an API operation
    • Tooling languages that can be used when making the request, and a code sample for calling the operation in the selected language.
    • Response status codes for the operation, and the response body schema with an example.
      Sample requests in tooling languages, and responses for an API operation

    You can also click Definitions in the left pane and expand the sections to view the schema definition for each model, and an example.

    API model definitions
  3. To test any of the API operations, complete the following steps:
    1. Click the operation and then click the Try it tab.
      Generated authentication credentials are displayed together with the request parameters.
      Security credentials and HTTP parameters for a sample POST operation
    2. In the Parameters section, provide test data to pass in the request by using the Generate button to generate sample data or by specifying your own. The data required will vary by operation type and definition. For example:
      • For POST operations, you can generate sample data for body or query parameters. Or you can manually specify data that conforms to the body or query schema for the operation.
      • For GET operations, you can specify query or path parameters, and might need to specify an existing valid ID or some other value that uniquely identifies the data you are trying to retrieve from the target application.
      • For PUT operations, you can specify path or body parameters.

      The following example shows generated sample data in JSON format, for a POST operation that creates a contact in Salesforce. (In this particular example, we'll delete the CustomerID entry from the sample data because an ID does not need to be provided when creating a contact in Salesforce. Instead, Salesforce will generate an ID for the newly created contact and return it in the response. The CustomerID entry is generated by default in the sample because it was defined as one of the properties for the Customer model.)

      Completed Try it tab for a sample POST operation
    3. Click Send to invoke the API operation and then review the request and response that are displayed.

      For our POST example, the Response section displays the success code that is returned (201 Created), the headers, and the CustomerID value that represents the contact ID assigned by Salesforce.

      Sample response for an API call
    4. If relevant for the operation, check for the expected results in the target applications.

      For our POST example, we can see that our generated sample data was used to create a contact in our Salesforce instance. Notice that the contact ID in the URL for the Salesforce record is identical to the CustomerID value that is shown in the Response section in the test window.

      Test results for a POST operation in Salesforce