httphttp-headersswaggerhttp-accept-language

Swagger 2.0 Accept-Language header as request parameter


I'm writing a specification for a http API using Swagger 2.0.

How can I define the Accept-Language header as a required header parameter for a path?

/aPath:
post:
  parameters:
    - in: header
      name: Accept-Language
      type: string
      enum: [de, en, es]
      required: true
  responses:
    200:
      description: The Best
      schema:
        type: string

Documentation on header parameters says

Swagger specification has special keywords for some headers: enter image description here

How can I use the keyword produces to define an Accept-Language header?


Solution

  • Your definition is correct.

    The page you mentioned talks about the Accept header, which is different from Accept-Language.