Loading

Async processing in Kentico

Sometimes I can hear notes of skepticism about Kentico, especially from .NET developers, that Kentico can't build modern client side application like SPA which will meat high standards of nowadays UX. In this post I'm going to deny those blames and show Kentico possibilities in this direction.

REST Service
So I'm going to start from the sweet part: REST service. Kentico REST service is really flexible and gives you access to all objects and pages within the system and when talking all, I do not mean all standard, but any custom page type, custom table and any objects from custom modules. 

Retiving data with REST service
Kentico REST service allows you to pass a lot of different parameters when requesting data: columns, top n, where and many others which makes data retrival process really efficient. REST service returns either XML or JSON responses. The last one is very convenient for comsuming by javascript frameworks.

Security
First of all Kentico allows you to configure what type authentication you'd like to use for the REST service. Most likely you'll use Forms authentication for web site. Also it allows you to specify whether you want to access pages or object with REST service as well as you might specify which page types or classes exactly you want to access. You might allow only read access. With Forms authentication you may allow or deny some role to access particular section of your web site or object and system will handle this appropriately. Also you should not worry about SQL injections, as Kentico is secured from such.

Comsuming REST service
You are free to use any known javascript framework on the client in order to establish communication with server, or might go even with pure javascript. Recaling from my personal experience Knockout might be a good option to build view model and jQuery AJAX to handle communication with server. Angular JS is  also good and it does not require jQuery as it has it's own module $resource, where you might build something like URL routing, which allows you to process all types of requests as well as any object you need, which is really flexible and convenient. You can get custom web part, which will comsume REST service at Kentico Marketplace or directly from our site . Also you can find a sample of that web part here and try it yourself.

Drawbacks
The only drawback I can think of is fact that you can request only one object per request, no joins are available, no views are accessible with REST service. It might be a pain when you'd like to get a structure, e.g. user along with user settings. This example is not the most complex, sometimes you might need to retrieve really complex structure. You might send several request from the web page, which is not convenient, but possible.     


Please leave your questions or suggestions in blog comments.