API First Implementation using a Third-party Server

About this task

This use case explains the steps involved in adapting API First approach using a third-party implementation server.

The use case starts when you create an API in webMethods API Gateway and ends when you communicate the API implementation endpoint to webMethods API Gateway.

Before you begin
  • Ensure that you have the Manage API privilege in webMethods API Gateway.
  • Configure a third-party implementation server for implementing your APIs.

To adapt API First design using a third-party implementation server

Procedure

  1. Log on to webMethods API Gateway.
  2. Click APIs in the title navigation bar.
    A list of all existing APIs appears.
  3. Click Create API to create an API with required API documentation.
  4. Click Policies and define required policies for the API.
  5. Click Enable Mocking to mock and generate API mock responses.
  6. Using an external REST client such as Postman or SoapUI, run the below command to search for the API in webMethods API Gateway for implementation:
    POST http://<API Gateway host>:<port>/rest/apigateway/search
    {
     "types" : ["api"],
      "scope" : [
                    {
                        "attributeName" : "maturityState",
                        "keyword" : "ToBeImplemented"
                    }
                ]
    }

    The maturityState parameter in the above command is used search for APIs based on their maturity state. In this use case, you must search for APIs that are to be implemented. Hence, you can provide the ToBeImplemented value for the parameter. This command returns the list of APIs that are yet to be implemented.

  7. Using the API Id of the API that you want to implement, run the following command to retrieve the API contract from webMethods API Gateway:
    GET http://<host>:<port>/rest/apigateway/apis/{apiId}/
    providerspecification?format=swagger

    The value for the format parameter can be swagger, raml, or openapi for REST APIs; and wsdl for SOAP APIs.

    Note: You can search for an API based on its maturity status in webMethods API Gateway using the following command:
    POST http://<API Gateway host>:<port>/rest/apigateway/search
    {
     "types" : ["api"],
      "scope" : [
                    {
                        "attributeName" : "maturityState",
                        "keyword" : "ToBeImplemented"
                    }
                ]
    }
  8. Implement the API in the required implementation server.
  9. After implementation, invoke the REST end-point to communicate API implemented endpoint to webMethods API Gateway:
    PUT http://<API Gateway host>:<port>/rest/apigateway/apis/{apiId}/implementation
    {
      "maturityState": "string",
      "nativeBaseURLs": [
        "string"
      ]
    }
    

    You can provide required values for the parameters in the above command. For information on parameters, see List of Parameters used in API Implementation.

    Example:
    PUT http://10.2.151.149:5555/rest/apigateway/apis/
    94dfd243-dd54-4d7e-8ba5-396ffaf6fe4e/implementation
    {
    "nativeBaseURLs":["https://10.2.35.125:5556/ws/srvs:Calculator/
    CalculatorHttpSoap11Endpoint",
    "http://10.2.151.149:5555/ws/srvs:Calculator/CalculatorHttpSoap11Endpoint"],
    "maturityStatus" : "Implemented"
    }
    

    For details about the REST API, see the swagger file APIGatewayServiceManagement.json, located at Install directory/IntegrationServer/instances/default/packages/ WmAPIGateway/resources/apigatewayservices/APIGatewayServiceManagement.json. For more information about Service Management, see IBM webMethods API Gateway Developer's GuideService Management.

    As an outcome of the REST call, the mocking of the API is disabled and webMethods API Gateway starts requests for the actual implementation.