API Connect

API Connect

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  No response received on API Develop Test mode

    Posted Thu March 28, 2024 09:56 AM

    Hello, so I am currently developing a new simple CRUD API in AWS EC2. The server is up and running, and I can reliably send and receive data using Postman. I want to integrate my API into API Connect, and i have already made an OpenAPI 3.0 file that is sucessfully parsed by the GUI. However when i tried to test it to see if i can hit my API, this error occurs:
    ===========================================================

    No response received

    • This might be caused by one or more of the following:
    • a lack of CORS support on the target server(see suggestion below)
    • the server is unavailable
    • an untrusted certificate has been encountered
    • mutual SSL authentication is required

    If the error is caused by a lack of CORS support, click the link to open the server in a new tab. If the browser displays a certificate issue, you may choose to accept it and return here to test again.

    ===========================================================

    For the record I only made a simple PHP REST API using Laravel, and I turned off CORS etc. The OpenAPI design also passed the specification status, and my design isn't that much different from the sample orders API including the gateway setup since I just modified the file to my usecase.

    Is there something I missed or must do before testing? Because nothing worked so far for me. Thanks in advance.

    P.S. Here's my OpenAPI file:

    openapi: 3.0.0
    info:
      version: 1.0.0
      title: Coffee API
      x-ibm-name: coffee-api
    servers:
      - url: /coffee-api
    x-ibm-configuration:
      properties:
        target-url:
          value: http://omitted/api
          description: URL of the proxy policy
          encoded: false
      cors:
        enabled: false
      gateway: datapower-api-gateway
      type: rest
      phase: realized
      enforced: true
      testable: true
      assembly:
        execute:
          - invoke:
              backend-type: detect
              header-control:
                type: blocklist
                values: []
              parameter-control:
                type: allowlist
                values: []
              http-version: HTTP/1.1
              timeout: 60
              verb: keep
              chunked-uploads: true
              persistent-connection: true
              cache-response: protocol
              cache-ttl: 900
              stop-on-error: []
              graphql-send-type: detect
              websocket-upgrade: false
              title: invoke
              version: 2.0.0
              target-url: $(target-url)
              follow-redirects: false
              inject-proxy-headers: true
      activity-log:
        enabled: true
        success-content: activity
        error-content: payload
    paths:
      /coffees:
        get:
          operationId: getAllCoffees
          summary: Returns all coffees
          responses:
            '200':
              description: A list of coffees, or an empty list
        post:
          operationId: createCoffee
          summary: Create a new coffee
          requestBody:
            required: true
            content:
              application/json:
                schema:
                  $ref: '#/components/schemas/Coffee'
          responses:
            '201':
              description: Coffee created
      /coffees/{id}:
        get:
          operationId: getCoffeeById
          summary: Returns a specific coffee
          parameters:
            - name: id
              in: path
              required: true
              schema:
                type: integer
          responses:
            '200':
              description: A single coffee
            '404':
              description: Coffee not found
        put:
          operationId: updateCoffee
          summary: Update a coffee
          parameters:
            - name: id
              in: path
              required: true
              schema:
                type: integer
          requestBody:
            required: true
            content:
              application/json:
                schema:
                  $ref: '#/components/schemas/Coffee'
          responses:
            '200':
              description: Coffee updated
            '404':
              description: Coffee not found
            '500':
              description: Internal server error
        delete:
          operationId: deleteCoffee
          summary: Delete a coffee
          parameters:
            - name: id
              in: path
              required: true
              schema:
                type: integer
          responses:
            '204':
              description: Coffee deleted
            '404':
              description: Coffee not found
            '500':
              description: Internal server error
      /coffees/external:
        get:
          operationId: getExternalCoffees
          summary: Get coffees from an external service
          responses:
            '200':
              description: A list of coffees
            '500':
              description: Internal server error
    components:
      schemas:
        Coffee:
          type: object
          properties:
            id:
              type: integer
            name:
              type: string
            type:
              type: string
            price:
              type: number
            description:
              type: string
            stock:
              type: integer


    ------------------------------
    Muhamad Yoga Mahendra
    ------------------------------


  • 2.  RE: No response received on API Develop Test mode

    Posted Thu March 28, 2024 11:31 AM

    Hi Muhamad,

    That message is very typical for issues with SSL handshakes, for example, self signed certificates, untrusted certificates, etc, and if you click the link and continue, the browser will do a HTTP GET which would fail with a 405 method not supported unless your API supports a GET method for your particular path, or it could work and give you a response if you do have that GET method.  That process would tell the browser you're fine with the SSL issue.  If you've done so already, are you still getting this error when trying your test request again?
    Regards,
    Steve



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------



  • 3.  RE: No response received on API Develop Test mode

    Posted Thu March 28, 2024 06:57 PM

    Hello Steve,

    My API supports a GET method for the particular path I'm testing, which is /api/coffees. I just tested it again using Postman and it worked, as seen below.

    Postman GET result

    I also tried opening the API directly in my browser, with the same result:

    Browser Screenshot

    When I clicked the link provided by the popup, it simply returns an Error 404: API not found for requested URI, as shown here:

    404
    Regards,
    Muhamad


    ------------------------------
    Yoga
    ------------------------------



  • 4.  RE: No response received on API Develop Test mode

    Posted Fri March 29, 2024 05:48 AM

    Update:

    I just tinkered around the URL and URI configurations, now if I add the baseURL the error changes to 500: URL Open Error

    However I didn't manage to track the root cause of the API Connect Gateway unable to connect to my AWS endpoint.



    ------------------------------
    Yoga
    ------------------------------



  • 5.  RE: No response received on API Develop Test mode

    Posted Fri March 29, 2024 02:46 PM

    Hi Yoga,
    The URL Open error could be anything from a TLS issue with the backend server (assuming you're using https) or could be a network issue not allowing traffic to get to the endpoint.  I've not worked with the AWS environment, but a review of the DataPower logs would be helpful.   I'm assuming DataPower is a pod/container so you may need assistance getting access to those logs.
    Regards,

    Steve



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------