Is REST API Possible with Codeigniter? |
(12-09-2017, 06:06 AM)mahesh2150 Wrote: That is a good tutorial. CodeIgniter does not include a REST API so no, the tutorial is not maintained by CodeIgniter. (12-09-2017, 06:06 AM)mahesh2150 Wrote: Is it safe to use in my projects?What do you mean by safe? As far as it goes the code should work but I would say there are problems. The main one being that user input is being trusted without being verified or sanitized. Never trust user input! There might be other issues but I did not examine the tutorial in depth. From my point of view there is some coding there that (at best) points to a less than full understanding of CodeIgniter or (at worst) indicates a thoughtless approach to coding. For instance, this bit of code. PHP Code: //API call - add new book record The if statement is totally unnecessary. Since index() returns true or false why use the if conditional? Instead, simply return the results from index(). PHP Code: //API call - add new book record And again the input is accepted "as-is" which is far from a best practice. To be fair, it's important to recognize that the tutorial is not presented as complete and robust production level code. It simply demonstrates basic concepts. (12-09-2017, 06:06 AM)mahesh2150 Wrote: But missing the security part. You are asking about Authentication which is a separate concern from REST API. There are many third-party authentication libraries build for CodeIgniter. Community Auth and Ion_Auth are but two that are in wide use. There are others and also lots of examples on how to do-it-yourself. Any of these could be integrated using a RESTful API. |
Messages In This Thread |
Is REST API Possible with Codeigniter? - by mahesh2150 - 12-09-2017, 03:32 AM
RE: Is REST API Possible with Codeigniter? - by alinsimy - 12-09-2017, 04:56 AM
RE: Is REST API Possible with Codeigniter? - by InsiteFX - 12-09-2017, 05:08 AM
RE: Is REST API Possible with Codeigniter? - by mahesh2150 - 12-09-2017, 06:06 AM
RE: Is REST API Possible with Codeigniter? - by dave friend - 12-09-2017, 08:09 AM
RE: Is REST API Possible with Codeigniter? - by skunkbad - 12-09-2017, 11:01 AM
RE: Is REST API Possible with Codeigniter? - by dave friend - 12-09-2017, 12:24 PM
RE: Is REST API Possible with Codeigniter? - by InsiteFX - 12-10-2017, 04:46 AM
RE: Is REST API Possible with Codeigniter? - by dave friend - 12-10-2017, 08:26 AM
RE: Is REST API Possible with Codeigniter? - by legend1995 - 12-06-2019, 04:47 AM
RE: Is REST API Possible with Codeigniter? - by InsiteFX - 12-06-2019, 12:16 PM
RE: Is REST API Possible with Codeigniter? - by legend1995 - 12-06-2019, 12:47 PM
|