CodeIgniter Forums
Why RESTful? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Choosing CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=8)
+--- Thread: Why RESTful? (/showthread.php?tid=80074)



Why RESTful? - hieuhiti - 09-09-2021

Hi All,
I'm use CI4 to build Web server for App Mobile.
WebServer return result for App Mobile as My Format Json String.
I have learned about "RESTful Resource Handling", I don't understant the difference between My Format Json String vs result RESTful.
What is Benefits of RESTful Resource Handling? Hope everyone can explain and show the best way to apply.
Thanks All,


RE: Why RESTful? - paliz - 09-10-2021

1 Rest ful reaponse is json object

2 restful controller input data could be formdata or json object

3 restful methods get put post delete


RE: Why RESTful? - hieuhiti - 09-10-2021

(09-10-2021, 02:28 AM)paliz Wrote: 1 Rest ful reaponse is json object

2 restful  controller input data could be formdata or json object

3 restful methods get put post delete

Thanks your Feedback,

Current, In Controller, I use template from FuntionHelper to reaponse json object with my format json, apply all controllers. 

My format json same as: 
Code:
{"Status":200,"Msg":"Connected","Data":{"List":[],"Type":"Export"}}


I don't understant, different between my way vs RESTful (ci4 supports).

To return json results for Mobile App, Which solution should I apply?


RE: Why RESTful? - paliz - 09-11-2021

restful reaponse check by status code if 200 means ok

Body could be any thing usellay data=> is return

When error happen for exmple status code 400 means conflict

Reponse body has error=> object




Thats all