Try OpenEdge Now
skip to main content
Online Help
Introducing OpenEdge REST : Tasks : Developing ABL REST Web applications : Working with the REST Expose Editor : Mapping REST resource verb parameters
 
Mapping REST resource verb parameters
After you specify mapping between the REST interface-annotated ABL routine and the defined REST resource verb, you need to create mapping rules that associate the interface parameters (input and output parameters of an ABL routine) with the response or request parameters (input and output parameters in the REST resource). The REST Expose Editor provides a visual mapping tool to create the mapping rules.
A REST resource verb includes two distinct parameter mapping:
*Request Mapping - Interface input and output parameters can be mapped to any of the header, body, cookie, query string parameters, path parameter, or form parameter elements of the incoming HTTP request.
*Response Mapping - Interface Input-Output and Output parameters are mapped to any combination of header, body, cookies and response code elements in the outgoing HTTP response.
When you select a REST resource verb in the Verbs Association section, the mapping definition section on the REST Expose Editor displays hierarchical representations of the REST resource parameters and the ABL routine parameters. There is a tab for each type of parameter mapping: Input and Output.
On Input tab, input parameters to operation are mapped from elements of a request component that consists of the following:
*Request URL parameters including resource URI, query string parameter, and form parameter
*Request HTTP message including method, cookies, and headers
*Server context including servlet request, response, context, and config
You can map each element of the request to input parameters.
On Output tab, output parameters from an operation are mapped to a HTTP (REST resource) response.
Elements of a HTTP parameters include:
*Interface parameters
*Advanced parameters including constants
Elements of a HTTP response include:
*Response status line including response code
*Response headers (also content-type) including headers and cookies
*Response body
In the mapping definition section, the source tree is on the left and the target on the right. For input parameters, the Request is the source and the interface parameters (ABL routine parameters) is the target; for output parameters the interface parameters (ABL routine parameters) is the source and the Response is the target. To create a mapping rule, click on the parameter field and drag a line to the required operation parameter.
When creating a rule for mapping an interface parameters that contains a simple type (integer, string, or boolean) to a HTTP (REST resource) parameter that contains similar type, you can drag a line between the elements as follows:
*Click on an element that you want to map and drag a line to an element you want to map it to. Repeat this step for each mapping rule that want to define.
The mapping section represents each defined rule with a blue line between elements.
Note: You can delete a defined mapping rule, by selecting the blue line defined between the elements and selecting Delete from the context menu or pressing the DELETE key. Delete All option on the context menu allows you to remove all the defined mapping rules.