Great RESTful API tutorial for CI4, thank you Alex! I just spent 40 minutes trying to find out why my updating method wasn't working. I'm posting here just in case somebody else gets into the same tar pit. I was getting this 403 forbidden response when trying to update the blog post. The reason is I'm working on a public domain, not localhost. In this case I was only allowed to use GET and POST methods. So I changed to POST and still couldn't get it to work. It turns out that when changing to POST I also have to change the Presenter Route to add the 'update' on the URL as blog/update/(:blog_id)
Hello, I'm using "resource" and I just want to add manually an alternate $routes->post('events/(:segment)', 'Events::update/$1'); that replace PUT and PATCH (because with axios it doesn't work well). But it doesn't work for some reason! I don't understand why. Since presenter and resource are very similar, can you help me to understand? (I already found a workaround, but this thing keep bugging me)
I don't understand why codeigniter 4 provide so many ways to do the same thing, but some are too much automated (and obscure, since the confusionary or lacking documentation). I'm very confused.
Hi Alex, thanks for the video. I'm a long time user of Codeigniter 2 but never made the jump so your videos are fantastic. Just a curiosity. In this line... return $this->failValidationError($this->validator->getErrors()); I get an the following error; Argument 1 passed to CodeIgniter\\RESTful\\ResourceController::failValidationError() must be of the type string, array given. Now, I could loop the array from the getErrors() function but I'm curious how you would handle that. Thanks
Hi Alex, Great video, but I will like to know how I can loop through an array and add additional data to it Eg: $shops['shops'] = $model_shop->getShops($user['user_id']); now I want to add additional data foreach array in $shops['shops] , and return $this->respond($shops);
Hello Alex. Your tutorial is amazing. I have a question, I hope You can answer this. I need limit the delete of the posts to one or two users. How can I do that? Thanks.
Hi alex, sorry my english is bad I want to ask. why is $ this-> model-> insert ($ data) not working in my place, I have tried checking with var_dump ($ data) and it has data but after that var_dump ($ post_id) has no data contents
Hi, Arun, if the response of the request is successful then the update is successful. Or what exactly do you mean? If the update would fail, you would get an error
@@AlexLancer Hi, probably what he meant is what if he updated the blog that is not exists, what the response would look like. Because in your update API didnt provide checking wheter blog is exsited or not before updating it
why would you use t_id as argument? I would ve use localhost/request/update/12354567 class Request function update(t_id){ echo t_id; ///would print 12354567 }
Great RESTful API tutorial for CI4, thank you Alex!
I just spent 40 minutes trying to find out why my updating method wasn't working. I'm posting here just in case somebody else gets into the same tar pit. I was getting this 403 forbidden response when trying to update the blog post. The reason is I'm working on a public domain, not localhost. In this case I was only allowed to use GET and POST methods. So I changed to POST and still couldn't get it to work. It turns out that when changing to POST I also have to change the Presenter Route to add the 'update' on the URL as blog/update/(:blog_id)
Hello, I'm using "resource" and I just want to add manually an alternate $routes->post('events/(:segment)', 'Events::update/$1'); that replace PUT and PATCH (because with axios it doesn't work well). But it doesn't work for some reason! I don't understand why.
Since presenter and resource are very similar, can you help me to understand? (I already found a workaround, but this thing keep bugging me)
I don't understand why codeigniter 4 provide so many ways to do the same thing, but some are too much automated (and obscure, since the confusionary or lacking documentation). I'm very confused.
I feel the same when compare it with CI3. It just get a little bit more clear when i started to familiar myself with the autoloading
thank you alex you are great
Thank you
Thanks you alex you really teach me a lot . About oauth2 . When token expired how can we renew the token without re-login? Thanka you in advance
Thanks Alex, how do i create an endpoint with a custom query?
14:02 This 'action not implemented' problem is fixed in CI4 version 4.1.1
Thank you Kelvin
Hi Alex, thanks for the video. I'm a long time user of Codeigniter 2 but never made the jump so your videos are fantastic. Just a curiosity. In this line... return $this->failValidationError($this->validator->getErrors()); I get an the following error; Argument 1 passed to CodeIgniter\\RESTful\\ResourceController::failValidationError() must be of the type string, array given. Now, I could loop the array from the getErrors() function but I'm curious how you would handle that. Thanks
Hi Alex, Great video, but I will like to know how I can loop through an array and add additional data to it
Eg: $shops['shops'] = $model_shop->getShops($user['user_id']); now I want to add additional data foreach array in $shops['shops] , and return $this->respond($shops);
how to pass http basic auth from CI not from postman?
Hello Alex.
Your tutorial is amazing.
I have a question, I hope You can answer this.
I need limit the delete of the posts to one or two users. How can I do that?
Thanks.
Hello how can i get the current user connected
Hi alex, sorry my english is bad
I want to ask. why is $ this-> model-> insert ($ data) not working in my place, I have tried checking with var_dump ($ data) and it has data but after that var_dump ($ post_id) has no data contents
Hey, Muhammad, can you post your code somewhere so that I can see it?
@@AlexLancer github.com/mhmmdhasnan/restapi/blob/master/app/Controllers/Blog.php
This is my link github alex
helo your api is working
?????
i realy need in my project
plz plz answer
@@helpingjini8837 wait
How to make crud image sir?
Amazing video!
Thanks!
Hi Alex, I want to create Rest API in modules. How can we achieve this.
Shouldn't it be the same way ?
Hi Alex, it's a fantastic video :) But I have a question, how can I know the update was successful or not?
Hi, Arun, if the response of the request is successful then the update is successful. Or what exactly do you mean?
If the update would fail, you would get an error
@@AlexLancer Hi, probably what he meant is what if he updated the blog that is not exists, what the response would look like. Because in your update API didnt provide checking wheter blog is exsited or not before updating it
Hi Alex, this is my request, please try to make any simple application using ci rest API with react framework
Hey, I am not into react. I use VueJS for my SPA projects.
@@AlexLancer then u have any ideas to use Vuejs with CI 4 ???
@@unboxkarunadu372 I might do a video with VueJS using this RESTapi project
@@AlexLancer Yes please! :)
@@AlexLancer flutter bro pleasseeeeee
1st like
Thanks for being the first😀
How we can add query into uri segment like localhost/request/update?t_id=12354567
why would you use t_id as argument?
I would ve use localhost/request/update/12354567
class Request
function update(t_id){
echo t_id; ///would print 12354567
}
@@AlexLancer I want to get a request based on t_id(Terminal Id) instead of request_id(Primary Key).