Proteggiamo il tuo ambiente digitale da qualsiasi attacco informatico. Sfrutta tutte le potenzialità della piattaforma SGBox!

Gallery

Contatti

Via Melchiorre Gioia, 168 - 20125 Milano

info@sgbox.it

+39 02 60830172

Search another article?

Playbooks – Generic API

You are here:
< Back

Generic API request

This node can be configured with url, headers and parameters to get the output from any HTTP API.

URL – if the complete url is already known, insert it into the Value field and select Fixed as type. Otherwise, the url can be composed of several concatenated url parts, added by
Each value have a type:

  • Fixed: for values already known
  • Fixed JSON: same as fixed, with the value in JSON format
  • Extract from previous output: if the value has to be extracted from the output of another node. E.g.: a token obtained as a response from a previous API call
  • Extract from previous response headers: as the previous one, but the value is in the headers of the response, not in the output.
  • Start Timestamp or End Timestamp: for requests with parameters that are time ranges and have to be updated at every request.
    Given the timestamp format and, if needed, a timezone and a number of seconds to add/subtract, the node will automatically compute the values, based on the last request.
    Build to be used in periodic requests to retrieve logs from an API.

When the value has to be extracted, a list of the other nodes is displayed. Choose one and you will get its output, from which to select the value. If no value is selected, the whole output of the node will be used, if possible.

The composition of headers and parameters is the same of the url parts one.All values can be preceded by a prefix or followed by a suffix.

Generic API request

Set url and parameters and make the request.
Playbooks - Generic API

Generic API request with a parameter extracted from a previous request. In this example, the previous request return 5 sgbox events. We selected type = “Extract from previous output”, selected the previous node and got its output on the right. Then from the JSON we clicked on the value for the “event_id” parameter of our request, i.e. the first patternid from the previous request, and the value field was filled with 0.patternid)

Playbooks - Generic API

Generic API request with Start and End timestamp to extract logs from an API. In this example, the API request has two parameters, start_ts and end_ts, that are re-calculated every time the node is executed or tested. In the dump section, you can see the values. In the second execution, the value of start_ts is the end_ts of the previous execution, while the value of end_ts is the current time.

Playbooks - Generic API
Download the PB module – samples package for examples.