Welcome Guest, Not a member yet? Register   Sign In
Help with RESTful Resource Routes
#1

Hi,


Reading REST Resource Naming Guide item 2.4. Never use CRUD function names in URIs, I noticed that the example on the CI4 documentation doesn't follow that. Did I understand correctly? Am I missing something?


Thanks.
Reply
#2

$routes->resource('photos'); from documentation does that, what your link to REST Guide says it should do (use HTTP request methods)
But with codeigniter you can also easy do eg. deletion with uri segements, like $routes->post('photos/(Confusedegment)/delete' - it depends on the application, personally I don't think its completly wrong this way.
Reply
#3

(03-16-2022, 08:51 AM)sba Wrote: $routes->resource('photos'); 
But the CI documentation has a controller route "photos/(Confusedegment)/edit". That doesn't follow the Restful guide, does it?
Reply
#4

You're correct.

Strictly speaking,
PHP Code:
photos/(:segment)/edit 
is not needed in REST API.

You can remove the edit:
https://codeigniter.com/user_guide/incom...l.html#id3
Reply
#5

(03-17-2022, 01:04 AM)kenjis Wrote: You're correct.

Strictly speaking,
PHP Code:
photos/(:segment)/edit 
is not needed in REST API.

You can remove the edit:
https://codeigniter.com/user_guide/incom...l.html#id3

Ok. Thank you.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB