Test the stock manager API

Test your newly created API by invoking it directly from the z/OS® Connect API toolkit by using the API Explorer..

Before you begin

Ensure that you have the API Discovery feature enabled in the server.xml server configuration by adding the following element to the feature list:
<feature>apiDiscovery-1.0</feature>
Note: Use of the API Discovery feature requires that you are using z/OS Connect V3.0.48 and z/OS Connect API toolkit V3.0.9.4, V3.2.9.4, or later.

Procedure

  1. Start your IBM® MQ queue manager.
  2. Start the stock query application, see Prepare the sample IBM MQ stock query application.
  3. Start your IBM z/OS Connect server. For more information, see Starting and stopping IBM z/OS Connect.
    1. Check the messages.log file for the following message to confirm that the service is installed.
          BAQR7043I: z/OS Connect service archive stockQuery installed successfully.    
      
    2. Check the messages.log file for the following message to confirm that the API is installed.
          BAQR7000I: z/OS Connect API archive file stockmanager installed successfully.
      
  4. In the z/OS Connect Servers view of the API toolkit, under the APIs folder, double-click the stockmanager API.
    The API is opened in the API Explorer. If you are not using the API Explorer feature, select Open in Swagger UI from the context menu.
  5. Click List Operations to see available operations in the API.
    Figure 1. Operations in the API
    List of operations in the API.
  6. Query the state of the stock with item ID 2033.
    1. Specify a value of 2033 for the item-id and click GET.
      Figure 2. Testing the GET request
      List of operations in the API.
    2. Click Try it out!.
      Information about the request URL, request headers, response body, response code, and response headers are provided.

      An HTTP response code of 200 is expected with the following response body:
      {
        "SQRESP": {
          "ITEM_ID": 2033,
          "ITEM_DESC": "A description.",
          "ITEM_COST": 4,
          "ITEM_COUNT": 500
        }
      }
      

Results

You verified that your newly created stockmanager API has successfully called the stock query application by using the stock query service running in IBM z/OS Connect.