asp.net web api - WebApi response codes -
so let's have webapi controller called userscontroller. let's @ next examples:
1.navigating /users/1 returns json of user id = 1. http response code 200.
2.navigating /user/1 (note misspelled url!) homecoming response code 404. not need anything, web server homecoming code 404 me.
now question: response code (200 or 404) should returned url /users/2, if user id = 2 not exist in database? , why.
you should homecoming notfound (404), because url valid required resource doesn't exists. check this.
asp.net-web-api
No comments:
Post a Comment