-
Notifications
You must be signed in to change notification settings - Fork 1
Response
Ahmad elsaidy edited this page Mar 7, 2020
·
2 revisions
-
getStatusCode()
: return status code -
getMessage()
: return message from response -
getData()
: return data from response -
getWarnings()
: return array of warnings from response when status iswarning
-
getErrors()
: return array of errors when status is not success -
getCurlError()
: return the CURL error -
getStatus()
: return the response status -
isSuccess()
: Determined if the response succeeded -
isFailure()
: Determined if the response failure -
isWarning()
: Determined if the response succeeded but have warnings
We have an optional parameter in
getErrors
andgetWarnings
functions, you can use it to return errors/warnings with its keys
Returns by getStatus()
function.
success
failure
-
warning
: success but have warnings
Returns by getStatusCode()
function.
-
200
(OK): the API executed successfully. but maybe have warnings. -
400
(Bad request): The API failed, as a condition had been violated. example: trying to delete a resource with reference to another resource. -
401
(Unauthorized): invalid user credentials -
403
(forbidden): when the requested action is unauthorized for the user -
404
(Not found): the resource that you are requested is not found -
405
(Method not allowed): the API URL found but a method is not found. -
422
(Unprocessable Entity): input validation errors. -
500
(Internal server error): unexpected exception occurred. -
501
(Not Implemented): configuration is missing on the server. example: JWT_SECRET missing from the .env file