java blueprint_高颜值的api文档工具API Blueprint

具体使用参考上面博客链接,就是安装aglio,然后使用它来将markdown转化成html文件。ps:目前我习惯使用后台的swagger,在java代码上注释,具体可以参考https://www.jianshu.com/p/3d777aaa1da0 。 个人倾向于后者,因为swagger满足注释和api一起维护,乃后端福音~

输出效果

21edd759b616

image.png

markdown模板

FORMAT: 1A

HOST: http://polls.apiblueprint.org/

# Polls

Polls is a simple API allowing consumers to view polls and vote in them. You can view this documentation over at [Apiary](http://docs.pollsapi.apiary.io).

# Polls API Root [/]

This resource does not have any attributes. Instead it offers the initial API affordances in the form of the links in the JSON body.

It is recommend to follow the “url” link values, [Link](https://tools.ietf.org/html/rfc5988) or Location headers where applicable to retrieve resources. Instead of constructing your own URLs, to keep your client decoupled from implementation details.

## Retrieve the Entry Point [GET]

+ Response 200 (application/json)

{

"questions_url": "/questions"

}

## Group Question

Resources related to questions in the API.

## Question [/questions/{question_id}]

A Question object has the following attributes:

+ question

+ published_at - An ISO8601 date when the question was published.

+ url

+ choices - An array of Choice objects.

+ Parameters

+ question_id: 1 (required, number) - ID of the Question in form of an integer

### View a Questions Detail [GET]

+ Response 200 (application/json)

{

"question": "Favourite programming language?",

"published_at": "2014-11-11T08:40:51.620Z",

"url": "/questions/1",

"choices": [

{

"choice": "Swift",

"url": "/questions/1/choices/1",

"votes": 2048

}, {

"choice": "Python",

"url": "/questions/1/choices/2",

"votes": 1024

}, {

"choice": "Objective-C",

"url": "/questions/1/choices/3",

"votes": 512

}, {

"choice": "Ruby",

"url": "/questions/1/choices/4",

"votes": 256

}

]

}

## Choice [/questions/{question_id}/choices/{choice_id}]

+ Parameters

+ question_id: 1 (required, number) - ID of the Question in form of an integer

+ choice_id: 1 (required, number) - ID of the Choice in form of an integer

### Vote on a Choice [POST]

This action allows you to vote on a question's choice.

+ Response 201

+ Headers

Location: /questions/1

## Questions Collection [/questions{?page}]

+ Parameters

+ page: 1 (optional, number) - The page of questions to return

### List All Questions [GET]

+ Response 200 (application/json)

+ Headers

Link: ; rel="next"

+ Body

[

{

"question": "Favourite programming language?",

"published_at": "2014-11-11T08:40:51.620Z",

"url": "/questions/1",

"choices": [

{

"choice": "Swift",

"url": "/questions/1/choices/1",

"votes": 2048

}, {

"choice": "Python",

"url": "/questions/1/choices/2",

"votes": 1024

}, {

"choice": "Objective-C",

"url": "/questions/1/choices/3",

"votes": 512

}, {

"choice": "Ruby",

"url": "/questions/1/choices/4",

"votes": 256

}

]

}

]

### Create a New Question [POST]

You may create your own question using this action. It takes a JSON object containing a question and a collection of answers in the form of choices.

+ question (string) - The question

+ choices (array[string]) - A collection of choices.

+ Request (application/json)

{

"question": "Favourite programming language?",

"choices": [

"Swift",

"Python",

"Objective-C",

"Ruby"

]

}

+ Response 201 (application/json)

+ Headers

Location: /questions/2

+ Body

{

"question": "Favourite programming language?",

"published_at": "2014-11-11T08:40:51.620Z",

"url": "/questions/2",

"choices": [

{

"choice": "Swift",

"url": "/questions/2/choices/1",

"votes": 0

}, {

"choice": "Python",

"url": "/questions/2/choices/2",

"votes": 0

}, {

"choice": "Objective-C",

"url": "/questions/2/choices/3",

"votes": 0

}, {

"choice": "Ruby",

"url": "/questions/2/choices/4",

"votes": 0

}

]

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值