Search code examples
apigeeswagger

Apigee127: Issue in running a mock api locally


I wrote up a swagger file in the following manner:

swagger: "2.0"
info:
  version: "0.0.1"
  title: API Specification 116
# during dev, should point to your local machine
host: localhost
# basePath prefixes all resource paths 
basePath: /
# 
schemes:
  # tip: remove http to make production-grade
  - http
  - https
# format of bodies a client can send (Content-Type)
consumes:
  - application/json
# format of the responses to the client (Accepts)
produces:
  - application/json
x-a127-config: {}
x-volos-resources: {}
paths:
  /v1/customers/{customer_id}/summary :
  #/welcome:
    # binds a127 app logic to a route
    #x-swagger-router-controller: summary
    #x-volos-authorizations: {}
    #x-volos-apply: {}
    get:
      description: ""
      operationId: summary
      parameters:
        - name: customer_id
          in: path
          description: "The desired customer information"
          required: true
          type: "string"

      responses:
        "200":
          description: Success
          schema:
            # a pointer to a definition
            $ref: CustomerSummaryResponse
        # responses may fall through to errors
        default:
          description: Error
          schema:
            $ref: ErrorResponse
# complex objects have schema definitions
definitions:
  CustomerSummaryResponse:
    properties:
      id:
        type: string
      firstName:
        type: string
      middleName:
        type: string
      lastName:
        type: string
      email:
        type: string
      role:
        type: string
      tenure:
        type: string
      msidn: 
        type: string
      accountId:
        type: string
      addresses:
        type: object
        properties:
          type:
            type: string
          addressLine1:
            type: string
          addressLine2:
            type: string
          cityName:
            type: string
          stateCode:
            type: string
          zip:
            type: string
          zipExt:
            type: string
      accounts:
         type: object
         properties:
           id:
              type: string
           type:
              type: string
           category:
              type: string
           name: 
              type: string
           numberOfLines:
              type: number



  ErrorResponse:
    required:
      - message
    properties:
      message:
        type: string

After which I wanted to run this locally mock this on my machine, so I did the a127 project start -m , subsequent to that I did a curl namely:

curl -i http://localhost:10010/v1/customer/12134/summary

I find that the curl command returns

C:\Apigee127>curl -i http://localhost:10010/welcome
curl: (7) Failed connect to localhost:10010; No error

I initially thought maybe something was wrong with the port but not sure Any suggestions?


Solution

  • Try this:

    curl -4 -i http://localhost:10010/v1/customer/12134/summary
    

    It will force curl to use IPv4 instead of IPv6.

    Scott