我想记录一下实际的JSON字段本身代表什么。
我已经记录了GET语句和参数,但这并未提供完整的文档给用户。
因此,在下面的示例中,我将如何添加有关“OtherFields”的注释。支持这个吗?还是我需要在其他地方制作配套文档。
## View Applications [/cat{?sort}{&order}{&page}]
### List all Applications
### Get List of Applications [GET]
+ Parameters
+ sort (optional, string) ... `sort` parameter is used to specify which criteria to use for sorting. One of the following strings may be used:
`"NAME",
"RATING", "QUALITY" ,
"RISKLEVEL", `
+ order (optional, string) ... `order` parameter is used to specify which order to use if sorting is used. One of the following strings may be used:
`"ASC",
"DESC"`
+ page (optional, int ) ... `page` parameter is used to request subsequent catalog pages.
+ Response 200 (application/json)
{
"Catalog" : {
"Page" : 0,
"Count" : 6,
"Applications" : [{
"UID" : "6882e96a-5da1-11e3-1111-3f24f45df3ad"
"OtherFields: ""
}]
}}
最佳答案
更新:我们刚刚使用MSON syntax推出了一个描述属性的beta版本。
然后可以将原始有效负载描述为
### Get List of Applications [GET]
+ Response 200 (application/json)
+ Attributes
+ Catalog (object)
+ Page: 0 (number) - Number of the page
+ Count: 6 (number) - Count of *Lorem Ipsum*
+ Applications (array) - Some array of something
+ (object)
+ UID: `6882e96a-5da1-11e3-1111-3f24f45df3ad`
+ OtherFields
+ Body
{
"Catalog" : {
"Page" : 0,
"Count" : 6,
"Applications" : [{
"UID" : "6882e96a-5da1-11e3-1111-3f24f45df3ad"
"OtherFields": ""
}]
}
}
请注意,主体中的显式JSON是多余的,您可以完全跳过它。有关其他详细信息,请参见API蓝图规范– Attributes。
关于json - 养蜂场:是否可以记录什么是JSON响应字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21043514/