Friday, 10 June 2016

ATG 11.2 Rest MVC API Configuration, example of using it in profile module using Advance Rest Client Application

In general, a REST Web Services exposes data and function resources through the use of Uniform Resource Identifiers (URI). HTTP methods are used by the REST services to point to a resource like Form Handler, Droplet, Components, Methods, JSP etc.
Rest API makes the application client platform independent and mobile development ready as REST clients may be accesses from any browser, and security can be configured for each call.

ATG Rest MVC support GET and only POST method although Legacy REST Support PUT and DELETE but in ATG 11.2 it recommended to use only ATG REST Web Services.

Installing and Configuring the REST MVC
                Installation of the REST MVC module can be done using Oracle Commerce Platform Configuration and Installation Manager (CIM) or CRS mobile store selection while installing CRS 11.2 will install this folder.
Below a Screen Shot from CIM


After Installation you can check ATG REST Module in your ATG installation folder


In your Base module add REST on ATG-Required in MANIFEST file


When you build your ear you should find atg-rest-web1.0.war as below


Enabling REST Services
For security reasons, when you install the REST MVC module, none of the REST services are enabled. To enable a service, you should follow below steps.

1.       Disable enforceSessionConfirmation in atg/dynamo/service/actor/Configuration.propertes. This is require to enable the development mode.



You can find this file inside your atg 11.2 installation.


Second important file is ActorChainRestRegistry.properties. We can call only registered service in this file


You can find this file in your ATG 11.2 installation folder


Third important file is beanFilteringConfiguration.xml which used to map and render your output.


We can find this file in ATG 11.2 folder a below.


Lets now add Profile Actor to enable basic functionality of Login, Logout, Create, Edit

Add the ProfileActor.properties to your working codebase to enable future customization.


You can find this file at


Add the profileActor.xml in to your working codebase for future customization. Like repositories the xml append should work but I did not tested yet.


You can find in your Installation folder as below


Configure your ProfileFormHandler.properties as per your requirement




How it work and example    
Through Advance Rest Client (ARC) extension you send XML or JSON to the profile Actor it actually call the profile form handler’s handle methods and send result success URL or errors and Error URL.


Example
Lets log in using the rest API



No comments:

Post a Comment

  SyntaxError : (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape Solution:...