Documentation forServer & Application Monitor

Chain multiple API requests in a single API poller in SAM

Starting in SAM 2020.2.1, you can send an initial request to an API to get a value, and then save the value as a variable that can be passed to subsequent requests that are chained together in a single API poller. This can be useful for APIs that involve tokens, sessions, or endpoint discovery.

For example, if an APIs requires tokens, the initial API request can retrieve a token that is then passed along to headers of subsequent API requests to authenticate access to data. The VMware vCenter Inventory template uses this technique.

To chain multiple API requests in a single API poller:

  1. Click Settings > All Settings > Manage API Pollers.
  2. On the Manage API Poller page, click New, select the row for a node, and then click Create API Poller.

  3. Select GET as the Method.
  4. Click Configure to provide details about the API poller, such as a name, credentials, and thresholds; see Add API pollers in SAM for details. Click Save when finished.
  5. Provide a header, if required.
  6. Click Send Request.
  7. When the response appears, click the Monitor () icon next to the value you want to use in subsequent requests (for example, a token needed to authenticate data).
  8. In the next dialog box:
    1. For "How should we store this value?" select "Use as a variable in subsequent request.

    2. Enter a name for the variable.

      In later requests, the value uses the following notation: ${varName}.

    3. Click Save to close the dialog box.
  9. To create another request in the same API poller, click Options () > Duplicate.

  10. When the page displays a set of fields for the new request, you can use the variable defined in the previous request. In the following example, the variable is added to the URL.

  11. Configure the new API request, as necessary, and then save your changes. To add a new request to the existing requests, click Options > Duplicate again.