Obtaining List of WFA Pack Contents using PowerShell and REST API

Sort of following on from this July 2017 post - WFA 4.1 RESTful API: A Few Notes + Some PowerShell.

I was curious to see if it’s possible using the WFA REST API, to remove all the contents from a community generated WFA Pack, delete the WFA Pack (without losing all the pack’s original contents, since they’ve been removed from the pack), and then re-create a “cleaner” pack (cleaner - because I’ve noticed some odd issues with community generated packs.) Unfortunately, I don’t believe it is possible having read the REST Web Services Primer, but I’m happy to be proved wrong. Still, some of my notes regards inspecting WFA packs might be useful.

For work related reasons (compatibility with customers environment) I’m using WFA here (as of writing this, WFA 5.1RC1 is the latest release).

If you’ve never used the PowerShell Invoke-RestMethod to talk to your WFA box, and use self-signed certs, you’ll need to run the below commands first:

$TypeToAdd = "using System.Net;using System.Security.Cryptography.X509Certificates;public class TrustAllCertsPolicy : ICertificatePolicy {public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) {return true;}}"

add-Type $TypeToAdd

[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

To store WFA credentials in a variable (C$), run:

$C = New-Object System.Management.Automation.PsCredential($(Read-Host "U"),$(Read-Host "P" -AsSecureString))

To get the packs, run:

$packs = Invoke-RestMethod -Method Get -uri https://wfa:443/rest/packs -Credential $C

To list all the packs, see the example below:

PS> $packs.collection.pack | foreach{$_.Name}
WFA pack with common entities
WFA pack for managing Clustered Data ONTAP
WFA pack for managing Data ONTAP in 7-Mode
WFA pack for managing vCenter

To list all the entities in a pack called “WFA pack with common entities”, see the example below:

PS> ($packs.collection.pack | where{$_.name -eq "WFA pack with common entities"}).entities.entity | Foreach{ ($_.Type) + ": " + ($_.Name) }
Remote System Type: Other
Function: getValueIfEnabled
Function: replaceFirst
Function: convertNullToValue
Function: listSize
Function: nextObjectNameWithSuffix
Function: getValueAt2DWithDefault
Function: returnNullOnEmpty
Function: padNumber
Function: getValueAt
Function: nextNamePaddedBy
Function: nextIPByIncrement
Command: Send email
Scheme: playground
Function: getValueAt2D
Function: toLower
Function: nextIP
Function: getColumnValues
Command: Acquire data source
Function: roundRobinNextIP
Command: Wait for data source acquisition
Function: getSize
Function: splitByDelimiter
Function: minimumSize
Function: toUpper
Function: convertNullToZero
Function: isElementPresent
Function: nextNamePadded
Function: getValueFrom2DByRowKey
Function: nextName



I created an empty pack, then went to the entities REST API page using Google Chrome (for the example below: https://wfa/rest/packs/4409d8fe-527f-4819-b5b7-12027d9fe2e9), acquired the XML, then used a free online XML to JSON converter (check out https://extendsclass.com/xml-to-json.html or https://codebeautify.org/xmltojson) to see what the “Empty Pack” looks like in JSON:

 "pack": {
  "name": "Empty Pack",
  "version": {
   "major": "1",
   "minor": "0",
   "revision": "0"
  "certification": "NONE",
  "description": "Empty Pack",
  "author": "Empty Pack",
  "entities": "",
  "link": [
    "_rel": "self",
    "_href": "https://wfa/rest/packs/4409d8fe-527f-4819-b5b7-12027d9fe2e9",
    "__prefix": "atom"
    "_rel": "exportToServerFolder",
    "_href": "https://wfa/rest/packs/folder/4409d8fe-527f-4819-b5b7-12027d9fe2e9",
    "__prefix": "atom"
    "_rel": "list",
    "_href": "https://wfa/rest/packs",
    "__prefix": "atom"
    "_rel": "export",
    "_href": "https://wfa/rest/dars/4409d8fe-527f-4819-b5b7-12027d9fe2e9",
    "__prefix": "atom"
  "_xmlns:atom": "http://www.w3.org/2005/Atom",
  "_uuid": "4409d8fe-527f-4819-b5b7-12027d9fe2e9"

APPENDIX: Definitions of all the common links that might appear in responses.

The following table contains the definitions of all the common links that might appear in responses. These relations are standard across all WFA object collections.

Note: If a particular relation does not appear in a response object, it might either mean that this particular operation is not supported for that object or mean that the operation or relation specified by the link is not relevant to the current context.

Table: Definitions of all the common links that might appear in responses.

Apart from a partial or complete set of the standard actions listed above, objects in a given object collection might support several non-standard actions and relations that are specific to that object. The following sections in this document that describe these object collections also contains a table that explains all the standard and non-standard links a given object supports.


  1. Hii
    You can also use https://onlinexmltools.org/ for online xml converter like XML to JSON,YAML,CSV,BASE64,TSV,PlainText
    XML to Minfiy XML to Beautify.


Post a comment