Wednesday 9 March 2016

ATG Rest WebServices Introduction

The ATG REST Web Services provide access to Nucleus components. The Oracle ATG Web Commerce platform REST Web Services expose methods that get component data and get and set component property values. You cannot use the Oracle ATG Web Commerce platform REST Web Services to delete components.



REST Web Services exposes data and function resources through the use of Uniform Resource Identifiers (URIs). These resources are used within simple, well-defined operations. HTTP methods are used by the REST services to point to a resource. Each HTTP request returns an HTTP response, which indicates the status of the operation. The application that receives the request identifies the format of the response, which is JSON or XML. REST clients may be accessed from any browser, and security can be configured for each call.

ATG REST WEB SERVICES

The application path for REST URLs, which is the portion of the URL that follows the hostname and port number, starts with /rest/.  The REST MVC framework uses /model.The Legacy REST framework uses /bean, /repository or /service, depending on the component used.

For example:
http://servername:port/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder




HTTP requests and responses are the way that the ATG REST Web Services communicate. The following HTTP methods are used and supported by ATG REST Web Services:

Method
Explanation
GET
Use this method to return data.
Examples of the values you may get are repository item and Nucleus component property values, RQL query results, repository items, and Nucleus components.
POST
Use this method to invoke functionality or make changes to your Oracle ATG Web Commerce platform server.
For example, you may invoke methods, update Nucleus component properties, and create repository items.
PUT
(Legacy REST Only) Use this method to make changes to your Oracle ATG Web Commerce platform server.
For example, you may update repository item and Nucleus component property values.
DELETE
(Legacy REST Only) Use this method to remove repository items.

Returning Data

ATG REST Web Services returns the results of operations that you perform in an HTTP response message body. The output data can be returned in either JavaScript Object Notation (JSON) or eXtensible Markup Language (XML) format.

Enabling REST Services:

After adding the REST module to current module list in CIM follow the steps given in
integration-of-atg-with-rest-webservices


 When using REST services, you want to prevent the processing of malicious site requests. Oracle ATG Web Commerce platform uses a request parameter _dynSessConf, which contains a session confirmation number, to verify that a request is legitimate. For further information on session confirmation numbers, and the warnings that occur if the request is not legitimate

ATG REST ARCHITECTURE

Actor Types

The REST MVC API’s modular and extensible functionality is based on actors, which uses a number of different types of actors to perform a variety of functions. The atg.service.actor.Actor interface contains the following actor types that perform specific actions or provide configurations.

  • Component Actor – You use this actor to set component property values or invoke methods on a component, or to read component property values
  • Droplet Actor – Use this actor when you want to invoke droplets and output data from the droplet to the ModelMap. Inputs are mapped to the droplet input parameter. Other types of actors can be nested in the oparam parameter of a DropletActor
  • Form Actor – Use this actor to set up form handler inputs and submit a form
  • JSP Actor – This actor invokes a JSP page and adds the JSP response or JSP-defined variables to the ModelMap
  • Nested Actor – These actors allow you to invoke actor-chains from within other actor-chains, helping to define modular units of work that can be combined and extended.
  • Variable Actor – The VarActor enables you to set variables in the actor context


REST XML SCHEMA DIAGRAM

Bean Filtering


The BeanFilterService filters the properties of a java bean or repository item and converts beans into a map of properties. The BeanFilterService reads XML definition files that define which properties of a Java class or repository item should be included in the filtered view of the object. The XML definitions include ways to remap property names and transform properties.
By default, the BeanFilterService is applied to the ModelMap by the REST MVC framework before generating a JSON or XML response. However, you can filter objects at any time. For example, you can use the BeanFilterService as a ComponentActor to filter a repository item before adding it to the ModelMap.


ATG Rest WebServices Examples are Explained Here.

REFERENCES:

 Notes / theory is copied majorly from Orcacle DOCS

0 comments:

Post a Comment

 
;