8 Krypton

SRM REST wildcard queries and PS Invoke-RestMethod

Jump to solution

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):

https://srm.mydomain.local:58443/APG-REST/metrics/series/values?filter=name='UsedCapacity'&model='VM...

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

Labels (1)
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Highlighted
8 Krypton

Re: SRM REST wildcard queries and PS Invoke-RestMethod

Jump to solution

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

0 Kudos
1 Reply
Highlighted
8 Krypton

Re: SRM REST wildcard queries and PS Invoke-RestMethod

Jump to solution

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

0 Kudos