Dmi*_*nov 6 rest apiary.io apiblueprint
是否可以为某些请求的每个响应指定描述?假设,我们有一个请求
### Retrieve resource [GET]
+ Headers
If-None-Match: "Version1"
Run Code Online (Sandbox Code Playgroud)
还有2个回复
+ Response 200 (application/xml)
+ Headers
ETag: "Version2"
+ Body
<Xml>
<A>
<B />
<C />
</A>
</Xml>
+ Response 304 (application/xml)
Run Code Online (Sandbox Code Playgroud)
我想要的是指定这里的描述(请注意右下方的注释+ 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
Run Code Online (Sandbox Code Playgroud)
可能吗?
目前,无法在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
...
Run Code Online (Sandbox Code Playgroud)
请注意,为了支持内容协商,很可能在不久的将来会有一些有限的分支支持.
| 归档时间: |
|
| 查看次数: |
3365 次 |
| 最近记录: |