| Key | Value | Remark |
|---|---|---|
| Os-Type | ios / android | Required |
| App-Version | 1.0.0 | Required |
| Api-Version | 1 | Required |
| Accept | application/json | Required |
| Authorization | Bearer {token} | For API with Authentication |
| Language | en / cn | For Apps with multilingual (Optional)) |
| Timezone | +8 | For Apps required to handle different timezone (Optional) |
| Method | Description |
|---|---|
| POST | To create a resource |
| GET | To read a resource or collection of resources |
| PUT | To update/modify/replace a resource |
| DELETE | To destroy a resource |
{
'status': true,
'code': 400000,
'message': 'Category created successfully',
'data': [] / {},
'debug': null
}
throw BadRequestExceptionHandler.php under app/Exceptionsif($something_happen){
throw (new BadRequestException("New Version Available", 409))
->withErrorKey(ResponseCode::FORCE_UPDATE, "FORCE_UPDATE")
->withValue($anything);
}
| HTTP Code | Apps Exception | Message |
|---|---|---|
| 400 | InvalidRequestException | eg. Insufficient Credit (Message from backend) |
| 401 | UnauthorizedException | Unauthorized |
| 404 | NotFoundException | Not Found |
| 409 | ForceUpdateException | New Version Available |
| 422 | ValidationException | eg: The name field is required (First Error Message in error list) |
| 429 | TooManyRequestException | Too Many Attempts |
| 500 | InternalServerErrorException | Server Error |
| 503 | MaintenanceException | Service Unavailable (Apps to show under maintenance page) |