{
  "swagger": "2.0",
  "info": {
    "title": "Advanced Attributes API",
    "version": "",
    "description": "Improving the previous [Attributes](08.%20Attributes.md) description example, this API example describes the `Coupon` resource attributes (data structure) regardless of the serialization format. These attributes can be later referenced using the resource name\n\nThese attributes are then reused in the `Retrieve a Coupon` action. Since they describe the complete message, no explicit JSON body example is needed.\n\nMoving forward, the `Coupon` resource data structure is then reused when defining the attributes of the coupons collection resource – `Coupons`.\n\nThe `Create a Coupon` action also demonstrate the description of request attributes – once defined, these attributes are implied on every `Create a Coupon` request unless the request specifies otherwise. Apparently, the description of action attributes is somewhat duplicate to the definition of `Coupon` resource attributes. We will address this in the next [Data Structures](10.%20Data%20Structures.md) example.\n\n## API Blueprint\n\n+ [Previous: Attributes](08.%20Attributes.md)\n\n+ [This: Raw API Blueprint](https://raw.github.com/apiaryio/api-blueprint/master/examples/09.%20Advanced%20Attributes.md)\n\n+ [Next: Data Structures](10.%20Data%20Structures.md)"
  },
  "paths": {
    "/coupons/{id}": {
      "get": {
        "responses": {
          "200": {
            "description": "OK",
            "headers": {},
            "examples": {
              "application/json": {
                "id": "250FF",
                "created": 1415203908,
                "percent_off": 25,
                "redeem_by": 0
              }
            },
            "schema": {
              "$ref": "#/definitions/Coupon"
            }
          }
        },
        "summary": "Retrieve a Coupon",
        "description": "Retrieves the coupon with the given ID.",
        "tags": [
          "Coupons"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The ID of the desired coupon.",
            "required": true,
            "type": "string"
          }
        ],
        "produces": [
          "application/json"
        ]
      }
    },
    "/coupons": {
      "get": {
        "responses": {
          "200": {
            "description": "OK",
            "headers": {},
            "examples": {
              "application/json": [
                {
                  "id": "250FF",
                  "created": 1415203908,
                  "percent_off": 25,
                  "redeem_by": 0
                }
              ]
            },
            "schema": {
              "$ref": "#/definitions/Coupons"
            }
          }
        },
        "summary": "List all Coupons",
        "description": "Returns a list of your coupons.",
        "tags": [
          "Coupons"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items.",
            "required": false,
            "type": "number",
            "default": 10
          }
        ],
        "produces": [
          "application/json"
        ]
      },
      "post": {
        "responses": {
          "200": {
            "description": "OK",
            "headers": {},
            "examples": {
              "application/json": {
                "id": "250FF",
                "created": 1415203908,
                "percent_off": 25,
                "redeem_by": 0
              }
            },
            "schema": {
              "$ref": "#/definitions/Coupon"
            }
          }
        },
        "summary": "Create a Coupon",
        "description": "Creates a new Coupon.",
        "tags": [
          "Coupons"
        ],
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "schema": {
              "type": "object",
              "properties": {
                "percent_off": {
                  "type": "number"
                },
                "redeem_by": {
                  "type": "number"
                }
              }
            }
          }
        ],
        "produces": [
          "application/json"
        ]
      }
    }
  },
  "definitions": {
    "Coupon": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "created": {
          "type": "number",
          "description": "Time stamp"
        },
        "percent_off": {
          "type": "number",
          "description": "A positive integer between 1 and 100 that represents the discount the coupon will apply."
        },
        "redeem_by": {
          "type": "number",
          "description": "Date after which the coupon can no longer be redeemed"
        }
      }
    },
    "Coupons": {
      "type": "array",
      "items": {}
    }
  },
  "securityDefinitions": {},
  "tags": [
    {
      "name": "Coupons"
    }
  ]
}