Configuring an operation

One or more HTTP operations together form a Path. These operations are different ways of interacting with an API and you can use GET, POST, PUT, DELETE, HEAD, PATCH, and OPTIONS operations.

About this task

An operation must have at least one successful response defined.

Procedure

To configure an operation, complete the following instructions:

  1. If you have not previously pinned the UI navigation pane then click the Navigate to icon The Navigate to icon.
    The API Designer UI navigation pane opens. To pin the UI navigation pane, click the Pin menu icon The Pin menu icon..
  2. Click Drafts in the UI navigation pane, and then click APIs.
    The APIs tab opens.
  3. Click APIs.
    The APIs tab opens.
  4. Click the REST API definition that you want to work with.
  5. In the Paths section, under the Path to which your operation belongs, click the operation that you want to work with.
    The operation's details expand.
  6. Optional: In the Add Tag field, add any tags that you want to associate your operation with.
  7. Optional: In the Summary field, provide a summary of your operation.
  8. Optional: In the Operation ID field, provide an identifier for your operation. The operation ID must not be shared by any other operations.
  9. Optional: In the Description field, provide a description of your operation.
  10. Optional: Add any parameters that you want to include for only the operation you are configuring.
    1. Click Add Parameter in the operation's section.
    2. In the Name field, provide a name for your parameter.
    3. In the Located In field, select where the parameter is found in the call of your operation.
    4. Optional: In the Description field, provide a description of your parameter.
    5. Use the Required check box to specify whether the parameter is required for a call to be valid.
      Note: The purpose of setting a parameter as required is to set the required field for the parameter in the OpenAPI (Swagger 2.0) definition file to true, so that the requirement is documented for consumers of the API. The requirement is not enforced by the IBM® API Connect Gateway, nor is it enforced by the API test tool (allowing you to verify the behavior of the API when the parameter is missing.)

      However, the requirement is enforced by the Explore tool, and by the Developer Portal test tool, because the purpose of these tools is to explore the correct operation of the API.

    6. Optional: From the drop-down list for Type, select the type of data that the parameter is expected to have when the call is received by API Connect. If you have set Located In to Body then you can select a JSON schema that you have defined for your API. For more information about creating JSON schemas, see Step 24 of Composing a REST API.
  11. Add or edit any responses that you want to include.
    These responses are only for the OpenAPI (Swagger 2.0) definition of your API that is provided to developers and are not used for any purposes other than documentation.
    1. Optional: To add a response, click Add Response.
    2. In the Status Code field, provide the HTTP status code that might occur.
    3. In the Description field, provide text to be returned for the specified status code.
    4. Optional: If you have defined any JSON schemas in the Definitions section of the Design tab of your draft API, you can select to reference one of them from the drop-down menu for Schema. For more information on creating JSON schemas, see Step 24 of Composing a REST API.
  12. Choose which security definitions apply to your operation. By default, an operation uses the security definitions of the API to which is belongs. You can change this by using the check boxes under Security to select individual security definition.
    Note: The Use API security definitions option implements all of the API's security definitions and must be cleared before you can select other definitions individually.
  13. Clear the Use API consume types check box to override the media type with specific configurations in the operation. In addition to JSON and XML, which are supported by API Connect, you can add other media types by using the Add Media Type field.
  14. Clear the Use API produce types check box to override the media type with specific configurations in the operation. In addition to JSON and XML, which are supported by API Connect, you can add other media types by using the Add Media Type field.
  15. Click the Save icon The Save icon. to save your changes.

Results

You have configured your operation and can add more operations to your Path.