diff --git a/README.md b/README.md index b5fca82..1b6f738 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ When setting up a JSON API, you'll have all kinds of different types of calls an - +
TypeDescriptionRequired KeysOptional Keys
successAll went well, and (usually) some data was returned.status, data
failThere was a problem with the data submitted, or some pre-condition of the API call wasn't satisfiedstatus, data
failureThere was a problem with the data submitted, or some pre-condition of the API call wasn't satisfiedstatus, data
errorAn error occurred in processing the request, i.e. an exception was thrownstatus, messagecode, data
@@ -59,18 +59,18 @@ Required keys: * status: Should always be set to "success". * data: Acts as the wrapper for any data returned by the API call. If the call returns no data (as in the last example), data should be set to null. -### Fail ### +### failure ### When an API call is rejected due to invalid data or call conditions, the JSend object's data key contains an object explaining what went wrong, typically a hash of validation errors. For example: #### POST /posts.json (with data body: "Trying to creating a blog post"): #### ``` { - "status" : "fail", + "status" : "failure", "data" : { "title" : "A title is required" } } ``` Required keys: -* status: Should always be set to "fail". +* status: Should always be set to "failure". * data: Again, provides the wrapper for the details of why the request failed. If the reasons for failure correspond to POST values, the response object's keys SHOULD correspond to those POST values. ### Error ###