Apigee127:在本地运行模拟API的问题

时间:2014-11-26 20:14:21

标签: apigee swagger

我用以下方式写了一个招摇文件:

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

之后我想在我的机器上运行本地模拟这个,所以我做了a127项目启动-m,之后我做了卷曲:

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

我发现curl命令返回

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

我最初认为端口可能有问题,但不确定是否有任何建议?

1 个答案:

答案 0 :(得分:1)

试试这个:

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

它将强制curl使用IPv4而不是IPv6。

斯科特