Search code examples
apiblueprint

How to specify request headers in API Blueprint


I am trying to define an API blueprint for a resource that utilises request headers to understand what content type to return.

## Offer [/offers/{offerCode}]

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

### View an Offer Detail [GET]

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

    {
        ........
    }

I want my request to be as follows:-

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

How can I document that using API Blueprint?


Solution

  • I'm not sure if I understand what you want to achieve but I'd say that you want to specify header for request and you can do that by specifying request the same way as response.

    ## 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)
    
        {
            ........
        }