Configuring a REST Web Data Source (Managed Package)

For the managed package runtime, configure a REST Web data source to get or post data from or to a public API.

Managed Package app icon This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.

For example, pull in weather data from a weather API based on a policy holder's postal code.

Note
Note

For optimal flexibility and easier implementation, use an Integration Procedure as a data source to execute multiple actions in a single server call. See Configure an Integration Procedure Data Source on a Flexcard (Managed Package).

To configure a REST data source:

  1. On the Vlocity Cards tab, click New to configure a data source for a new cards component, or select the component for which you want to configure a data source.
  2. In the Cards Designer, in the Layout or Cards pane, from the Data Source picklist, select REST.
    image
  3. From the Subtype picklist, select Web.
  4. In the Endpoint box, enter REST endpoint URL. For example:
    image
  5. Specify the REST method:
    • GET—Requests data specified by the parameters of the URL.

    • POST—Sends JSON data specified in the Body text area.

      image

    You can use Context Variables to pass inherited values with either method.

  6. Click +Add Header Variable to add request headers.

    Most third-party APIs expect headers, such as tokens, public keys, and content-type. For example:

    Request header

    Value

    Accept:

    application/json

    Accept-Language:

    en_US

    Token:

    Ke2B34kmpOU9wen

    If you are making a cross-domain REST API call, you must ensure that it abides by the Cross-Origin Resource Sharing (CORS) policy. For example, an API response that contains a request header named Access-Control-Allow-Origin: * enables CORS.

  7. (Optional). Enter values for these properties:
    • To drill down to a specific dataset, in the Result JSON Path field, enter a path. For example, enter records.results, which drills down to the results array and passes the array to the card or card layout.

    • To sort data by a specific data field, enter the field name in the Order By input field.

    • To reverse the order of the data returned, select True from the Reverse Order picklist.

      image
    • Set a Timeout value in milliseconds.

      The timeout value controls the time that the framework waits for the designated data source to return a response. Timeouts improve handling user interactions with long running processes. Setting an appropriate timeout value allows the application and users to react accordingly to long wait times.

    • Set an Interval value in milliseconds.

      The card component's data source refreshes continuously at the given interval and checks for changes in data source records. If changes are found, the layout or card component reloads. Setting an interval enables recursive updates of records.

  8. To preview a card using real data, add a test variable in the Test Data Source Settings fields. See Testing Data Source Settings (Managed Package).