A Complete REST API Tutorial |
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...stful.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');
No full tutorial yet, sorry.
It's on my to-do list, though ... https://github.com/codeigniter4/CodeIgni...ssues/2186
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
See if this can be useful https://www.youtube.com/watch?v=419WfgND-c8&t=
Codeigniter 4 - Docker Image [github] [docker hub]
Hi
Do we have any complete solution for Codeigniter 4 with REST API on github? (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.
Maybe this can be helpful
https://github.com/anmar-dev/ci4_RESTful_API
I enjoy coding in codeigniter4. SurveyIgniter a project where i learn about codeigniter4.
|
Welcome Guest, Not a member yet? Register Sign In |