是否可以指定对某个请求的每个响应的描述?假设,我们有一个请求
### Retrieve resource [GET]
+ Headers
If-None-Match: "Version1"和2份答复
+ Response 200 (application/xml)
+ Headers
ETag: "Version2"
+ Body
<Xml>
<A>
<B />
<C />
</A>
</Xml>
+ Response 304 (application/xml)我想说明的是这样的描述(请注意在+ Response行下面的注释):
+ Response 200 (application/xml)
In case if the resource hasn't changed
+ Headers
ETag: "Version2"
+ Body
<Xml>
<A>
<B />
<C />
</A>
</Xml>
+ Response 304 (application/xml)
In case if the resource has changed有可能吗?
发布于 2013-10-17 17:21:48
目前,在API蓝图中没有表达这种逻辑的方法。你总是可以在相应的反应或行动本身中描述它。例如:
# Resource [/1]
## Action [GET]
Explanation of this action here.
+ Request
...
+ Response 200
Explanation of this response.
+ Headers
...
+ Body
...
+ Response 304
Explanation of this response.
+ Headers
...注意,为了支持内容协商,在不久的将来很可能会有一些有限的分支支持。
https://stackoverflow.com/questions/19374197
复制相似问题