I am working with Phil Sturgeon's REST server . I get the following output from a GET request for a simple blog table I have (just test data):
{
"user_id": "1",
"entryid": "1",
"entry_name": "twkla nnn xxx",
"entry_body": "this is just UPDATED",
"status": "active",
"created_timestamp": "2016-05-01 21:25:51",
"updated_timestamp": "2016-11-12 17:29:38"
}
The url is like this:
https://www.example.com/v1/Blog/blog/id/1
However, when I make a get request for a id that doesn't exist, I get the following:
No webpage was found for the web address:
https://www.example.com/v1/Blog/blog/id/233
HTTP ERROR 404
I was hoping it would say no data found. How is that implemented?
Sorry, lots of ways to reply to a resource request. Here is the reply for no such blog found;
// Set the response and exit
$this->response([
'status' => FALSE,
'message' => 'No such blog was found'
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.