【问题标题】:How to specify request headers in API Blueprint如何在 API 蓝图中指定请求标头
【发布时间】:2015-05-13 19:55:57
【问题描述】:

我正在尝试为利用请求标头了解要返回的内容类型的资源定义 API 蓝图。

## Offer [/offers/{offerCode}]

+ Parameters
    + offerCode: summer2015 (required, string) - alphanumeric offer code

### View an Offer Detail [GET]

+ Response 200 (application/vnd.v0.1.0+json)

    {
        ........
    }

我希望我的请求如下:-

GET /offers/summer2015 HTTP/1.1
Host: my.api.com
Accept: application/vnd.v0.1.0+json

我如何使用 API 蓝图记录它?

【问题讨论】:

    标签: apiblueprint


    【解决方案1】:

    我不确定我是否理解您想要实现的目标,但我想说您想为请求指定标头,您可以通过指定请求与响应相同的方式来做到这一点。

    ## Offer [/offers/{offerCode}]
    
    + Parameters
        + offerCode: summer2015 (required, string) - alphanumeric offer code
    
    
    ### View an Offer Detail [GET]
    
    + Request 
    
        + Headers 
    
              Accept: application/vnd.v0.1.0+json 
    
    
    + Response 200 (application/vnd.v0.1.0+json)
    
        {
            ........
        }
    

    【讨论】:

      猜你喜欢
      • 2011-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-15
      • 2020-02-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多