我们正在考虑使用API Blueprint。有些情况下,我们希望一个请求返回一个正确的响应,而另一个请求返回一个“错误”的响应,比如一个400 bad request
,以便其他开发人员可以在apiary.io上使用模拟API,并处理它们的应用程序中的两种类型的响应。
下面是我创建的一个完全任意的示例:
## Thing [/thing/{id}]
Gets a thing but the thing id must be a prime number!
+ Parameters
+ id (string) ... ID of the thing, a prime number!
+ Model (application/json)
The thing itself.
+ Body
{
"description": "It is green"
}
### Retrieve a Single Gist [GET]
+ Response 200
[Gist][]
现在我想为/thing/40
添加一个响应。
+ Response 400
{ "error" : "Invalid request" }
但我不确定如何在API Blueprint中实现这一点。在apiary.io上的“旧”样式下可以实现这一点,但我们想转移到新语法。