In my MySQL database, I have a table named Messages which is having 4 rows , with unique message ID as 1,2,3,4.
When using REST Api I am accessing collection resource:
http://localhost:8080/messenger/webapi/messages
I am getting all the message entries as JSON , which is expected; Please find below :
[
{
"author": "Vineet",
"creation": "09/12/2017",
"id": 1,
"message": "Message1"
},
{
"author": "Puneet",
"creation": "09/12/2017",
"id": 2,
"message": "Message2"
},
{
"author": "Dad",
"creation": "09/12/2017",
"id": 3,
"message": "Message3"
},
{
"author": "Mom",
"creation": "09/12/2017",
"id": 4,
"message": "Message4"
}
]
When using REST Api I am accessing the individual resource:
http://localhost:8080/messenger/webapi/messages/1 or http://localhost:8080/messenger/webapi/messages/2 or http://localhost:8080/messenger/webapi/messages/3 or http://localhost:8080/messenger/webapi/messages/4
I am getting the expected response for every single resource e.g. for 1
{
"author": "Vineet",
"creation": "09/12/2017",
"id": 1,
"message": "Message1"
}
Problem : When I am trying to access url :
http://localhost:8080/messenger/webapi/messages/9 , where 9 is a resource that never exists in database.
I am getting a blank page or the last loaded page. and The HTTP Code coming is : 204.
When "9" id is not present , why is not there 404 message ? Why 204 ?