This post is more than 5 years old
24 Posts
0
1191
SRM REST wildcard queries and PS Invoke-RestMethod
Hi,
Using a REST client for Chrome lets me easily use wildcards in the queries for the SRM Rest API, e.g only list LUNs with certain name convention (alias):
In my setup this will list four LUNs, and I can see the client does URL encoding for me.
However, when I try to use the Invoke-RestMethod in Powershell (v4), this alias filter does not seem to work, and just send through all the LUNs and ignoring the alias field. My theory is that it is caused by by the URI translation, however, I have not found a way to specify my own translation, e.g " alias%3D%27&%25NXP_%25%27 ", or see what gets sent to the server.
Has anyone successfully gotten the SRM REST API wildcard query filter to work with PS' Invoke-RestMethod ?
John
NoDecaf
24 Posts
0
November 2nd, 2017 20:00
Ok,
I figured it out in the end. The URI needs to be selectively typed up with a combination of special characters and hex codes, however, this will work as a URI in PS:
APG-REST/metrics/series/values?filter=name=%27UsedCapacity%27%26model=%27VMAX250F%27%26alias=%27%25NXP%25%27&properties=device,part,model,dgstype,poolname,ismapped,ismasked,alias,unit,name&period=0&type=last&limit=-1