![]() |
A Complete REST API Tutorial - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: A Complete REST API Tutorial (/showthread.php?tid=74300) |
A Complete REST API Tutorial - Philos - 09-07-2019 Hello, is there a fully completed example project or tutorial? I'm trying to build REST API test in CI4. I've tried the steps described here : https://codeigniter4.github.io/userguide/incoming/restful.html But unfortunately when I try to reach controller, it's returning as an empty XML file. What do I missing? I was expecting a JSON file that contains data. I've never worked with APIs before. So I would be happy if you could explain it simply. I've used to following code: (I'm connected to database and I can see the raw data with "print_r") Controller PHP Code: <?php Model PHP Code: <?php Routes PHP Code: $routes->resource('categories'); RE: A Complete REST API Tutorial - ciadmin - 09-07-2019 No full tutorial yet, sorry. It's on my to-do list, though ... https://github.com/codeigniter4/CodeIgniter4/issues/2186 RE: A Complete REST API Tutorial - mintwint - 09-07-2019 You need set JSON response in your request. From the browser it will always be XML. You can JSON only leave in app/Config/Format.php, comment line 23 and 39: PHP Code: 'application/xml', // machine-readable XML RE: A Complete REST API Tutorial - atsanna - 09-08-2019 See if this can be useful https://www.youtube.com/watch?v=419WfgND-c8&t= RE: A Complete REST API Tutorial - myo - 03-25-2020 Hi Do we have any complete solution for Codeigniter 4 with REST API on github? RE: A Complete REST API Tutorial - monkenWu - 04-10-2020 (03-25-2020, 03:58 AM)myo Wrote: Hi Hello, you can use the cli-create plugin. Using this plugin you will be able to create rest-ful api controller and any files in the command line. After my testing, in the Codeigniter current version v4.0.2 will be able to automatically create a functioning APIs. Click-me to visit github. RE: A Complete REST API Tutorial - anmar_dev - 04-17-2020 Maybe this can be helpful https://github.com/anmar-dev/ci4_RESTful_API |