Search code examples
apiblueprint

How to specify error codes in Apiary Documentation?


I want to specify the various exceptions/errors that have to be returned while making an API call. How do I achieve this with Apiary.


Solution

  • Kyle's response is indeed correct. I will just add that if you want to add little bit more semantics to this you can write the other possible responses like this:

    ## 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
    

    Note: The + Body is needed (even though it is empty) to distinguish the description from a message-body.