Plum Fuse

You are here: Plum Fuse Docs » module » Fetch from URL

Fetch from URL

The Fetch from URL module is used to fetch the contents of an internet resource from within your IVR application and interpret the results. It can be used to fetch files, post data, and integrate with REST webservices. The Fetch from URL module currently supports the HTTP and HTTPS protocols with a variety of methods: GET, POST, PUT, and DELETE. Fetched data in JSON, XML, CSV, and plaintext format can be interpreted and stored in variables or the Stack.

Other supported features of HTTP include custom headers, PUT data, and HTTP Basic Authentication.

Options and Controls

Front Panel Controls

  1. Click this button to display the module menu
  2. Click this toggler to change to a variable containing the fetch URL for your Fetch from URL module
  3. Enter a fetch URL in this textbox for your REST integration
  4. Select one of the following methods from this drop-down menu: GET, POST, PUT, or DELETE
  5. Select one of the following return types from this drop-down menu: text, JSON, CSV, or XML
POST parameters

  1. Enter the variable that contains your fetch URL
  2. Enter the POST parameter in this textbox
  3. Click this toggler to change to a static textbox, where you would enter the value of your POST parameter
  4. Enter a variable containing the value for your POST parameter
  5. Enter a value for your POST parameter
  6. Click this plus button to add another POST parameter to your module
  7. Click this minus button to remove a POST parameter from your module
PUT data

  1. Click this toggler to change to a variable that contains the body that you want to send to your fetch URL
  2. Enter the body that you want to send to your fetch URL in this textbox

  1. Click this toggler to switch to static text, where you would enter the text that you want to send to your fetch URL
  2. Enter the variable that contains the body that you want to send to your fetch URL
Interpreting fetched JSON

  1. Selecting “One value” from this drop-down menu will extract a single value from your JSON object
  2. Enter the location of the value you want to extract from your JSON object

  1. Selecting “Object → Stack” from this drop-down menu will extract an object and place it onto one row in the stack (Note: you will need to use the Get Row from Stack module to extract the values from this row)

  1. Selecting “Array of objects → Stack” from this drop-down menu will extract an array of objects and place the objects as separate rows on the stack (Note: you will need to use the Get Row from Stack module to extract the values)

  1. Selecting “Array of values → Stack” from this drop-down menu will extract an array of values and place the values as separate rows onto the stack (Note: you will need to use the Get Row from Stack module to extract the values, using arrayItem as the fieldname.)
Interpreting fetched CSVs

  1. Select one option from the Separator drop-down menu: ”,”, ”;”, “|”, ”(space)”, ”(tab)”
  2. Select one option from the Quotes drop-down menu: ”,'
  3. Select an option from this drop-down menu to select one of the first three rows as a header or to choose no header and use a specified map

  1. Enter a fieldname in this textbox to use for a CSV column
  2. Enter a column number which this fieldname will correspond to
  3. Click this add button to add another fieldname-column mapping
  4. Click this remove button to remove a fieldname-column mapping
Interpreting fetched XML

  1. Select “1st matching node value” from this drop-down menu to extract the first matching XML node's value into a variable
  2. Enter an XPath in this textbox to select elements from the XML document

  1. Select “Matched node values → Stack” from this drop-down menu to return matched node values from your XML and place them as rows onto the stack (Note: you will need to use the Get Row from Stack module to extract the values, using nodeValue as the fieldname.)

  1. Select “Matched elems' attributes → Stack” from this drop-down menu to return matched element attributes from your XML and place them as rows onto the stack (Note: you will need to use the Get Row from Stack module to extract the values, with the attribute names as the fieldnames)

  1. Select “Matched elems' children → Stack” from this drop-down menu to take each matching element, finding their child elements and placing the child elements' values onto the stack (Note: you will need to use the Get Row from Stack module to extract the value, with the child elements' names as the fieldnames)
Custom HTTP headers and basic authentication

  1. Click this toggler to use a variable for the username
  2. Enter a username in this textbox
  3. Click this toggler to use a variable for the password
  4. Enter a password in this textbox
  5. Enter an HTTP header in this textbox
  6. Click this toggler to use a variable for the header value
  7. Enter a header value in this textbox
  8. Click this add button to add another HTTP header to your module
  9. Click this remove button to remove an HTTP header from your module

  1. Click this toggler to use static text for your username
  2. Enter a variable in this textbox for your username
  3. Click this toggler to use static text for your username
  4. Enter a variable in this textbox for your username
  5. Click this toggler to use static text for your header
  6. Enter a variable in this textbox for your header value

Menu Options

Error handling - Selecting this checkbox will enable additional nodes to handle error conditions. The “Server unavailable” node will be used when Plum Fuse is unable to fetch your URL from your server and the “Non-2xx response” node will be used when the fetch URL returns a non-2xx HTTP response.

Custom HTTP headers - Selecting this checkbox will enable you to enter custom HTTP header data to the fetch URL.

HTTP Basic Auth - Selecting this checkbox will enable you to enter a username and password to send to your fetch URL via HTTP Basic Authentication.

Notes

If your URL fetches data that cannot be interpreted as the selected content type, e.g., JSON/CSV/XML, unexpected results may occur. Please ensure the proper content type will always be returned by the webserver.

Please note that when using the option, “Array of values → Stack”, for JSON, you will need to specify your fieldname in the Get Row from Stack module as arrayItem. Also, please note that when using the option, “Matched node values → Stack”, for XML, you will need to specify the fieldname nodeValue.

Examples

For examples on how you could use all the various options of the Fetch from URL module (text, JSON, CSV, XML), please read the tutorial section on REST Webservice integration.

module/rest.0.txt · Last modified: 2013/08/16 11:41 by victor