如何在Apiary文档中指定错误代码?

Har*_*hit 11 apiblueprint

我想指定在进行API调用时必须返回的各种异常/错误.我如何通过Apiary实现这一目标.

Zde*_*nek 12

凯尔的回答确实是对的.我将补充说,如果你想为此添加更多的语义,你可以编写其他可能的响应,如下所示:

## POST /users/resendVerification/{userId}

Resends the user's verification code to the email address on record.

+ Response 201

+ Response 403

    Returned if the user does not have access to the requested account

    + Body

+ Response 404

    Returned if a user was not found for the given userId

    + Body
Run Code Online (Sandbox Code Playgroud)

注意:+ Body需要(尽管它是空的)来区分描述和消息体.