rest api methods |
Hello,
Using CodeIgniter Rest Server library https://github.com/chriskacerguis/codeig...stallation and reading doc/watching test "Example" controller I see that some options are written in file aplication/config/routes.php like PHP Code: $route['api/tours/users/(:num)'] = 'api/tours/users/id/$1'; It means that parameter (:num) is rendered as numneric id of user for get request. How better it would be to make requests for some data which are related to user(as above example), but not inside of add/update/delete/get actions of user for POST/PUT/DELETE/GET requests. I mean next: upload avatar image to user delete avatar image of user add/delete row into/from some descriptive table of user like, user_reviews, which has user_id ref to users table and review longtext field. I suppose something like this: POST /users/12/review/some long text... - add row with "some long text..." text into user_reviews for user #12 and for this I have to add some more rules in aplication/config/routes.php, like : PHP Code: $route['api/tours/addreview/(:num)/(:any)'] = 'api/tours/addreview/id/$1/$2'; where api/tours - is control of rest api requests addreview - is control for adding of new user_review Is this the proper way? Which can be best decision for this? Thanks! |
Welcome Guest, Not a member yet? Register Sign In |