You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Default functions that returns a specific http code, but in the same way the body responds
Params
Param
Description
data
array of data for response (allow null)
message
custom message to response (optional)
Functions Code HTTP 1XX
Http Code
Function Name
Description
100
Http100 or Continue
Response status "info" with HTTP 100
101
Http101 or SwitchingProtocols
Response status "info" with HTTP 101
102
Http102 or Processing
Response status "info" with HTTP 102
103
Http103 or EarlyHints
Response status "info" with HTTP 103
Functions Code HTTP 2XX
Http Code
Function Name
Description
200
Http200 or Ok
Response status "success" with HTTP 200
201
Http201 or Created
Response status "success" with HTTP 201
202
Http202 or Accepted
Response status "success" with HTTP 202
203
Http203 or NonAuthoritativeInformation
Response status "success" with HTTP 203
204
Http204 or NoContent
Response status "success" with HTTP 204
205
Http205 or ResetContent
Response status "success" with HTTP 205
206
Http206 or PartialContent
Response status "success" with HTTP 206
Functions Code HTTP 3XX
Http Code
Function Name
Description
300
Http300 or MultipleChoices
Response status "redirection" with HTTP 300
301
Http301 or MovedPermanently
Response status "redirection" with HTTP 301
302
Http302 or MovedTemporarily
Response status "redirection" with HTTP 302
303
Http303 or SeeOther
Response status "redirection" with HTTP 303
304
Http304 or NotModified
Response status "redirection" with HTTP 304
305
Http305 or UseProxy
Response status "redirection" with HTTP 305
307
Http307 or TemporaryRedirect
Response status "redirection" with HTTP 307
308
Http308 or PermanentRedirect
Response status "redirection" with HTTP 308
Functions Code HTTP 4XX
Http Code
Function Name
Description
400
Http400 or BadRequest
Response status "error" with HTTP 400
401
Http401 or Unauthorized
Response status "error" with HTTP 401
402
Http402 or PaymentRequired
Response status "error" with HTTP 402
403
Http403 or Forbidden
Response status "error" with HTTP 403
404
Http404 or NotFound
Response status "error" with HTTP 404
405
Http405 or MethodNotAllowed
Response status "error" with HTTP 405
406
Http406 or NotAcceptable
Response status "error" with HTTP 406
407
Http407 or ProxyAuthenticationRequired
Response status "error" with HTTP 407
408
Http408 or RequestTimeout
Response status "error" with HTTP 408
409
Http409 or Conflict
Response status "error" with HTTP 409
410
Http410 or Gone
Response status "error" with HTTP 410
411
Http411 or LengthRequired
Response status "error" with HTTP 411
412
Http412 or PreconditionFailed
Response status "error" with HTTP 412
413
Http413 or RequestEntityTooLarge
Response status "error" with HTTP 413
414
Http414 or RequestUriTooLarge
Response status "error" with HTTP 414
415
Http415 or UnsupportedMediaType
Response status "error" with HTTP 415
416
Http416 or RequestedRangeNotSatisfiable
Response status "error" with HTTP 416
417
Http417 or ExpectationFailed
Response status "error" with HTTP 417
421
Http421 or MissDirectedRequest
Response status "error" with HTTP 421
422
Http422 or UnprocessableEntity
Response status "error" with HTTP 422
423
Http423 or Locked
Response status "error" with HTTP 423
424
Http424 or FailedDependency
Response status "error" with HTTP 424
426
Http426 or UpgradeRequired
Response status "error" with HTTP 426
428
Http428 or PreconditionRequired
Response status "error" with HTTP 428
429
Http429 or TooManyRequests
Response status "error" with HTTP 429
431
Http431 or RequestHeaderFieldsTooLarge
Response status "error" with HTTP 431
451
Http451 or UnavailableForLegalReasons
Response status "error" with HTTP 451
Functions Code HTTP 5XX
Http Code
Function Name
Description
500
Http500 or InternalServerError
Response status "error" with HTTP 500
501
Http501 or NotImplemented
Response status "error" with HTTP 501
502
Http502 or BadGateway
Response status "error" with HTTP 502
503
Http503 or ServiceUnavailable
Response status "error" with HTTP 503
504
Http504 or GatewayTimeout
Response status "error" with HTTP 504
505
Http505 or HTTPVersionNotSupported
Response status "error" with HTTP 505
506
Http506 or VariantAlsoNegotiates
Response status "error" with HTTP 506
507
Http507 or InsufficientStorage
Response status "error" with HTTP 507
508
Http508 or LoopDetected
Response status "error" with HTTP 508
510
Http510 or NotExtended
Response status "error" with HTTP 510
511
Http511 or NetworkAuthenticationRequired
Response status "error" with HTTP 511
Examples
404 Error example
//Execution in phpreturn ApiResponse::NotFound(null, 'object not found!');
// or//Execution in php without paramsreturn ApiResponse::NotFound();
// orreturn ApiResponse::Http404();