I want to create a web application, where i can load data on run time through JavaScript(angularJS), my friend told me to use restful API for the conversion of data from MySQL to JSON format, the thing which is confusing me is that why should I use Restful API, when I can use the simple php function "json_enocode". What other functionalities and benefits, i get when i use Restful API ?
4
-
5REST is not only "json_encode" its a bit more...please check googleThaDafinser– ThaDafinser2015-09-29 06:32:44 +00:00Commented Sep 29, 2015 at 6:32
-
possible duplicate of connect AngularJS to mysql using my PHP service?Maheshwar Ligade– Maheshwar Ligade2015-09-29 06:38:02 +00:00Commented Sep 29, 2015 at 6:38
-
Rest full is not to use for just to encode data to json, you can do it using just angulat.toJson (yourObject). The thing is when you bulding a web application data you use in rest API available for rest call,you can use it for your other applications allso. An rest help you to build spa concept to a huge data transactions also.There are many usage of Rest study and have fun...Mohamed Nizar– Mohamed Nizar2015-09-29 06:38:22 +00:00Commented Sep 29, 2015 at 6:38
-
As of now, I know that Restful API can encode the MySQL data to JSON and the conditional statement which I use in my query at where clause like "where id=1" is equivalent to "siteaddress/?id=1". Can you tell me what other functionalities and benefits I get other than that when i use Restful API ? or can you give me a good link where i can find this ?mhk– mhk2015-09-29 06:50:43 +00:00Commented Sep 29, 2015 at 6:50
Add a comment
|
1 Answer
Restful API is not data encoding structure. I would suggest you read more about restful API and decide whether you need to create API for you web application or not.
Either way you'll use json_encode to encode your data to json. So, you don't need to create restful API to convert data to json.
3 Comments
mhk
As of now, I know that Restful API can encode the MySQL data to JSON and the conditional statement which I use in my query at where clause like "where id=1" is equivalent to "siteaddress/?id=1". Can you tell me what other functionalities and benefits I get other than that when I use Restful API ? or can you give me a good link where i can find this?
LIMEXS
I hope this link will be helpful en.wikipedia.org/wiki/Representational_state_transfer
mhk
Thanks for your rapid reply, got my answer here: stackoverflow.com/questions/1368014/…