Commit 0ffd880d authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Clarified failure handling fixed up incorrect 'fail' in error block

parent 5be24973
Pipeline #48 skipped
......@@ -123,7 +123,7 @@ The purpose of this field is to signify the status of the action just performed.
|fail|There was a problem with the data submitted, the 'data' field must contain additional information|message||
|error|An error occurred in processing the request, the 'data' field must contain additional information in a 'message' field and may contain an additional 'data:code' and 'data:errors' (array) fields|message|data:code,data:errors|
### Example success
## Example success
For a brief status message one could use...
```json
......@@ -167,7 +167,7 @@ For a successful status which returns a single result...
```
### Example for a fail
## Example for a fail
Failures must have a mesasge field...
```json
......@@ -177,12 +177,27 @@ Failures must have a mesasge field...
}
```
### Example for a error
Or it can be verbose...
```json
{
status: "fail",
message: "System failure, please try again later",
data: {
code: 17,
errors: [
"Contacting remote server failed",
"Server: xyz, Port: 123, Error: Connection reset by peer"
]
}
}
```
## Example for a error
An error can be brief...
```json
{
status: "fail",
status: "error",
message: "The contents of the 'subject' field is invalid"
}
```
......@@ -190,7 +205,7 @@ An error can be brief...
Or it can be verbose...
```json
{
status: "fail",
status: "error",
message: "Input failed validation",
data: {
code: 17,
......@@ -217,4 +232,5 @@ See the 'status' field definition above for examples.
# Acknoledgements
<div xmlns:cc="http://creativecommons.org/ns#" about="http://www.restapitutorial.com/lessons/httpmethods.html"><a rel="cc:attributionURL" property="cc:attributionName" href="http://www.RestApiTutorial.com">RestApiTutorial.com</a> / <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a></div>
\ No newline at end of file
<div xmlns:cc="http://creativecommons.org/ns#" about="http://www.restapitutorial.com/lessons/httpmethods.html"><a rel="cc:attributionURL" property="cc:attributionName" href="http://www.RestApiTutorial.com">RestApiTutorial.com</a> / <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a></div>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment