Add a Call REST Action

A Call REST action is used to call a REST API endpoint to create, update, delete or display records.

After you add a Call REST action, you need to specify the endpoint for the request. Depending on the endpoint, you might also need to provide it with input parameters to perform the request, such as an ID to identify a record.

This table lists the parameters that you typically need to provide for a Call REST action, for each type of endpoint. For a code example of a call to each endpoint type, see Call REST in the Oracle Visual Builder Page Model Reference. Regarding the action's returned result, it's assigned to the automatically generated variable set for the Store Result In property.

Type of Endpoint Use Typical Requirements
POST Add a new record.
  • Provide the new record: In the Parameters section of the Properties pane, assign the variable containing the data to the body property.

  • Provide endpoint's input parameters, if any: If the endpoint requires input parameters, use the Input Parameters section in the Properties pane to provide the required input parameters. Required input parameters are marked with an asterisk.

GET Get one or many records.

To get single record, provide the record's ID: In the Input Parameters section of the Properties pane, provide the record's ID using the input parameter for the record's ID.

DELETE Delete a record.
  • Provide the record's ID: In the Input Parameters section of the Properties pane, provide the record's ID using the input parameter for the record's ID.

PATCH Update a record.
  • Provide the updated data: In the Parameters section of the Properties pane, assign the variable containing the updated data to the body property.

  • Provide the record's ID: In the Input Parameters section of the Properties pane, provide the record's ID using the input parameter for the record's ID.

To use a Call REST endpoint:

  1. Add the action in one of three ways, depending on your preference and where you want it added:
    • Drag the action from the Actions palette onto the canvas, dropping the action either at the bottom edge of the action it is to follow, or at the top edge of the action it is to precede.
    • Double-click the action in the Actions palette to add it to an empty canvas or to the end of an action chain.
    • On the canvas, select the action that the new action is to follow, then double-click the new action in the Actions palette.

  2. Click Select beside the Endpoint property in the Properties pane.

    The Select Endpoint window displays a list of endpoints that are available in your application. Each business object and service usually exposes multiple endpoints, each one for a different purpose. For instance, you can have an endpoint for getting multiple records, one for getting a single record, one for updating a record, and one for deleting a record. Each endpoint has different properties that you need to specify. For instance, for an endpoint that retrieves a single record, the record's ID must be provided.
    Description of action-chain-editor-selectendpoint-dialog.png follows
    Description of the illustration action-chain-editor-selectendpoint-dialog.png

  3. Select an endpoint from the list and click Select.
    The properties for the REST call are displayed in the Properties pane, with required properties marked with an asterisk (*):

  4. If the REST call requires header or input parameters, click the associated Assign or Not Mapped link and use the assignment window to specify the value for the property. Click Save.

    You map variables to parameters in the assignment 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, right-click the line and select Delete. You can also select a parameter in the Target pane to view and edit the expression for its assignment in the lower pane.
    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.

  5. Specify any other properties that may be required for the REST call.
  6. To handle a REST call error, drag the first action to take if an error occurred onto the Create Error Handle area that appears at the bottom of the Call REST card on the canvas:

    The dropped action is added in an If condition that checks if an error occurred during the REST call. Configure the action in the Properties pane and add any other required actions to the condition.

The object returned by the Call REST action is automatically named and shown by the Store Result In property.

If the underlying REST API request returns a status code, the error object is returned for you to handle the error yourself, otherwise an auto-generated error notification is shown. For details about error handling and the return object, see Call REST in the Oracle Visual Builder Page Model Reference.

Service Definitions

To change the details of a service connection endpoint, such as its path, method (example: GET, PUT, HEAD) or the schema of the request or response, see Edit a Service Connection.

Transform Functions

For details about creating JavaScript functions that modify the format of data and parameters for REST requests and modify the format of data from Rest responses, see Add Transforms.