16

我正在尝试在 API Blueprint 中记录一个查询参数,但我不完全确定我是否做得正确。资源如下所示:

DELETE http://baasar.apiary-mock.com/user/{appId}/{userId}

该请求将停用用户,而以下将删除用户对象:

DELETE http://baasar.apiary-mock.com/user/{appId}/{userId}?force=true

这是我为此准备的蓝图降价:

## User [/user/{appId}/{userId}]
Handle user objects

+ Parameters
    + appId (required, number, `1`) ... Application ID (`appId`)
    + userId (required, number, `1`) ... Numeric `userId` of the User object to manage

### Remove an User [DELETE]
+ Parameters
    + force (optional, boolean, `false`) ... Set to `true` to remove instead of deactivate

+ Response 204

但是,当使用 Apiary 渲染它时,我只能force在参数列表中看到它,但它现在显示在示例 URL 中。这只是我误解了 GUI 还是应该以其他方式记录查询参数?

4

2 回答 2

19

您的蓝图非常好,问题是当前的 Apiary 文档没有正确处理 URI 参数。

你能试试新的文档吗?它应该正确处理 URI 参数。

URI 参数

编辑

正确的 URI 模板应该是:

http://baasar.apiary-mock.com/user/{appId}/{userId}{?force}
于 2014-04-03T18:28:09.177 回答
2

我的卷曲请求:

curl -k -u username:password https://api.techie8.io/api/1.0/bits?bit_type=1

养蜂场蓝图:

## Bits Collection [/bits?bit_type={bit_type}]

### List Latest bits [GET]

List all bits recently inserted into database.

+ Parameters
    + bit_type (number, optional, `1`) ... Type of bit to retrieve: 1: Bits, 2: Newsletter
于 2017-10-30T07:14:15.963 回答