Using Nintex Workflow to filter XML Web Request
The Goal
When using a “get” web request to retrieve information from a server, we wanted to use a Nintex Workflow (in SharePoint 2013) filter each item and store the information in a list. Essentially, do as follows:
- Clear SharePoint list
- Check server monitor list
- Store each server ID
- Query each server, storing server name
- If status does not equal:
- OK
- Disabled
- Store the status and corresponding error message
- Log the errored servers in SharePoint list
This runs every 5 minutes, allowing us to trigger alerts whenever the list has an item in it and check out the issues.
The Problem
The workflow is quite simple, but we noticed it wasn’t too easy to find information about how to manipulate the XML data. This is to say, given the screenshot in Figure 1 of the server list below, how do we collect the ID of each server so I can query it to check all monitoring statuses individually?
Figure 1 – Server Monitor List
Note: the status column displayed in Figure 1 will display status=”ok” regardless of the actual monitoring statuses of each server. As such, we can not filter on that status and do need to log each server ID to check the internal monitors of each one.
Shown below in Figure 2, we take a look at the first server (id=”43″). The next step is to scan each of the <monitor> elements, and if status were to be anything other than OK or Server Disabled, we would need to collect the status and errText elements.
Figure 2 – Monitor Info for One Server
The Solution
Using the Nintex Workflow Query XML action, we get the server list, and store each ID in a collection. No issues here, as the XML values required no filtering.