Files
linguist/samples/API Blueprint/attributes.apib
Daniel G. Taylor 828fc7a19b Add support for API Blueprint
This adds a grammar and samples for [API Blueprint][] based on the
[Sublime Text plugin][] from Apiary. The [Atom language][] is also based
on the Sublime plugin.

API Blueprint is now used in over [3,600 repositories][] on GitHub and has
[several][Aglio] [open source][Dredd] [tools][Drakov] available.

Here's an [example using Lightshow][Lightshow] to highlight a small API.

[3,600 repositories]: https://github.com/search?utf8=%E2%9C%93&q=FORMAT+1A+extension%3Aapib+extension%3Amd&type=Code&ref=advsearch&l=
[Aglio]: https://github.com/danielgtaylor/aglio
[API Blueprint]: https://apiblueprint.org/
[Drakov]: https://www.npmjs.com/package/drakov
[Atom language]: https://github.com/danielgtaylor/atom-language-api-blueprint
[Dredd]: https://github.com/apiaryio/dredd
[Lightshow]: https://github-lightshow.herokuapp.com/?utf8=%E2%9C%93&scope=from-url&grammar_url=https%3A%2F%2Fgithub.com%2Fapiaryio%2Fapi-blueprint-sublime-plugin%2Fblob%2Fmaster%2FAPIBlueprint.tmLanguage&grammar_text=&code_source=from-url&code_url=https%3A%2F%2Fraw.githubusercontent.com%2Fapiaryio%2Fapi-blueprint%2Fmaster%2Fexamples%2F12.%2520Advanced%2520Action.md&code=
[Sublime Text plugin]: https://github.com/apiaryio/api-blueprint-sublime-plugin
2015-04-28 22:21:30 -07:00

40 lines
1.4 KiB
Plaintext

FORMAT: 1A
# Attributes API
This API example demonstrates how to describe body attributes of a request or response message.
In this case, the description is complementary (and duplicate!) to the provided JSON example in the body section. The [Advanced Attributes](09.%20Advanced%20Attributes.md) API example will demonstrate how to avoid duplicates and how to reuse attributes descriptions.
## API Blueprint
+ [Previous: Parameters](07.%20Parameters.md)
+ [This: Raw API Blueprint](https://raw.github.com/apiaryio/api-blueprint/master/examples/08.%20Attributes.md)
+ [Next: Advanced Attributes](09.%20Advanced%20Attributes.md)
# Group Coupons
## Coupon [/coupons/{id}]
A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer.
### Retrieve a Coupon [GET]
Retrieves the coupon with the given ID.
+ Response 200 (application/json)
+ Attributes (object)
+ id: 250FF (string)
+ created: 1415203908 (number) - Time stamp
+ percent_off: 25 (number)
A positive integer between 1 and 100 that represents the discount the coupon will apply.
+ redeem_by (number) - Date after which the coupon can no longer be redeemed
+ Body
{
"id": "250FF",
"created": 1415203908,
"percent_off": 25,
"redeem_by:" null
}