Forums
Hi Niels,
Can I pick your brains again -- I am a pest - I know.
I notice that some ExtJS 3.4 functions use a RESTful store. Using REST to communicate to the server. Currently I haven't a clue about REST. How does REST relate to IceBreak? Answers in words of one sylable please.
Regards,
Syd
Re: REST
Hi Syd;
Representational state transfer services or REST-Services are "back to basics". I'm a huge REST fan since it removes all the overhead that i.e. SOAP has introduced.
It is as simple as the AJAX call you are making for returning a resultset in IceBreak. Rest services return what ever kind of data, so JSON is a good candidate. Parameters to a REST service are placed directly on the URL and the payload is placed in the HTTP body. So REST can only run on top of HTTP and HTTPS where SOAP can be wrapped in MIME/POP3 mails or forwarded to a service bus. REST is 100% what you have done until now with the plain HTTP protocol and IceBreak.
If you dig down in the description of REST you will however find, that the POST,GET,PUT,DELETE http methods are mapped to update,read,write and delete functionality in the basic description of REST. This often causes troubles since many sites abandon the user of PUT and DELETE http methods.
Therefor, you can implement the operation to perform (or function/method to call) on the url as func=GET and func=UPDATE and func=DELETE etc. and just use the POST/GET standard.
If you play with the ExtJS component wizard in IceBreak, you can see that it provides a server side code that returns JSON data from SQL with the IceBreak buildin-function SQL_Execute – This is a REST service.
And to setup the url in ExtJs to use the "func=xxx" instead of the HTTP method is quite simple:
http://blogs.ignia.com/Levi.Fleischman/archive/2009/07/26/extjsrest.aspx
http://edspencer.net/2011/02/proxies-extjs-4.html
Best regards,
Niels Liisberg