Add a Call REST Action

When you add a Call REST action to an action chain, you might need to specify input parameters for the endpoint request or create variables for the endpoint response that you can bind to page components.

When you add the Call REST action to an action chain, the endpoint that you select will depend upon the functions that are available. Depending on the function, you might also need to create some variables to map to the action’s parameters, such as input parameters and the action’s results. For example, an endpoint might require an ID to identify a record. In this case, you will need to create a page variable that stores the ID, and that variable needs to be mapped to the action’s input parameter. If you did not create the variables before creating the action chain, you can create a variable during the process of creating the action chain; you can also edit the action chain after creating the variables you need.

You will use the Call REST endpoint action in action chains that perform typical functions such as creating, updating, and deleting records, and any time you want to display the details of a record in a page. You can use the Quick Starts to help you create the action chains and variables for these functions.

Type of Endpoint Typical Requirements
POST

When you call a POST endpoint, you will typically need:

  • Parameters: The page variable for the data needs to be mapped to the parameters of the payload of the POST call.

  • No input parameter is required.

GET

When you call a GET endpoint, you will typically need:

  • Input parameter: The ID of the record you want to retrieve should be passed as an input variable.

  • The payload of the GET call needs to be assigned to a variable using the Assign Variable action.

When you want to send a request to a GET endpoint to retrieve a collection, you will typically use a page variable of the type ServiceDataProvider.

DELETE

When you call a DELETE endpoint, you will typically need:

  • Input parameter: The ID of the record you want to delete should be passed as an input variable.

  • There is no payload when calling a DELETE endpoint.

PATCH

When you call a PATCH endpoint, you will typically need:

  • Input Parameter: The page variable storing the ID of the record you want to update should be mapped to the Input Parameter.

  • Parameters: The page variable for the updated data needs to be mapped to the parameters of the payload of the PATCH call.

To add a Call REST endpoint to an action chain:

  1. Open the Actions editor for the page.
  2. Click the action chain in the list to open it in the Action Chain editor.
  3. Drag Call REST from the Actions palette into the action chain.

    You can drag the action onto the Add icon ( Add icon ) in the action chain, or between existing actions in the chain. The properties pane opens when you add the Call REST endpoint action to the action chain.


    Description of action-chain-editor-selectendpoint.png follows
    Description of the illustration action-chain-editor-selectendpoint.png
  4. Click Select beside the Endpoint property in the properties pane.

    The Select Endpoint window displays a list of the endpoints that are available in your application. Each business object and service usually exposes multiple endpoints. The endpoint that you select will depend upon the function of the action chain. The endpoint that you select will also determine the properties that you will need to specify for the action, for example, input parameters.


    Description of action-chain-editor-selectendpoint-dialog.png follows
    Description of the illustration action-chain-editor-selectendpoint-dialog.png
  5. Select an endpoint from the list. Click Select.
  6. Edit the action’s properties in the properties pane.

    The properties pane is displayed when the action is selected on the canvas.


    Description of action-chain-properties-callrest.png follows
    Description of the illustration action-chain-properties-callrest.png
  7. Optional: If the REST call requires input parameters, click Assign next to Input Parameters to map the variable for the input value to the action’s parameter. Click Save.

    You map variables to parameters in the Assign Input Parameters window by dragging the variable in the Sources pane onto the parameter in the Target pane. In some cases, you might need to make multiple mappings. To delete a line mapping a variable to a parameter, place your cursor on the line and then right-click to open a Delete option. You can select the parameter name to view the expression for the mapped variable.
    Description of action-chain-map-inputparameters.png follows
    Description of the illustration action-chain-map-inputparameters.png

    If a suitable variable does not exist, use the + icon beside the relevant node (Action Chain, Page, and so on) to create a new variable.

  8. Optional: If the REST call requires other parameters, click Assign in the Parameters section to open the window for mapping the variables to the action’s parameters. Click Save.

    If the structure and names of attributes match, they can be automapped. The mapping can also be done individually.

  9. Optional: Specify any other parameters that may be required for the action.
After adding the Call REST endpoint action, you can continue by adding more actions to the action chain, or by invoking the action chain from an event. If the REST call has a result, you might want to add a Fire Notification action, or add Assign Variables to the chain and map the result to a page variable.