+ 17
Difference Between AJAX and RestAPI's.
Any difference you know... 2) in case of ajax the returned data is in the form of JSON, can it be called as RestAPI ?
7 odpowiedzi
+ 9
So my understanding based on that is that AJAX refers to client side technologies whereas REST refers to server side protocols. Both are related to increasing the efficiency of web data flow.
+ 8
Sonic,Daniel Adam Aaron Stone so if my ajax is returning a data in JSON format can it be treated as a REST api ?
Thank you for your answers.
+ 5
AJAX is an method to asynchronously load content, whilest REST is an architecture priciple for scaleable distributed API's.
+ 5
In lay terms, You use rest API in your back-end, process data and output it to a webpage in JSON format.
In your front-end, you use AJAX to access the data from the API and do anything you like with this data on your front end.
Also note that AJAX can be also used in back-end as in the case of PHP AJAX.
Real life example:
A currency converter website provides *DATA* containing current currency rate and symbols through rest API.
You access these DATA from you application through AJAX and make necessary conversions based on your user inputs and the conversion rates
based on your question 2:
The answer is no! REST API is the technique used in presenting this DATA
+ 3
Ajax is asynchronous JavaScript and XML, it basically allows the web app to make asynchronous http requests back to the server to fetch some data. Rest API is a backend server architecture that makes it easier to build APIs. It's just a set of convention or practices you follow when building APIs
+ 3
No. JSON has nothing to do with REST. An API is an application interface. An Application is an stateful system. A distributed system (like an orchastration of webservices) makes it difficult to represent a state (as services are independent). So REST propagates to use HATEOAS (hypermedia as the engine of application state). Together with resources (as states) you'll have a statemachine, that is: a distributed application. (REST has nothing to do with frameworks or technology, it's a principle, but implementation with http and json works very well on internet environments for a bunch of reasons).