I am trying to receive some data from spectrum for our CMDB.
Now I have the following which works.
Now the problem is that I have another spectrum where there are more landscapes and I only want models from on specific landscape
<rs:model-request throttlesize='10000' xmlns:rs='http://www.ca.com/spectrum/restful/schema/request' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.ca.com/spectrum/restful/schema/request ../../../xsd/Request.xsd '>
<rs:requested-attribute id='0x1006e' />
<rs:requested-attribute id='0x10000' />
<rs:requested-attribute id='0x12d7f' />
<rs:requested-attribute id='0x12d80' />
<rs:requested-attribute id='0x12dbd' />
<rs:requested-attribute id='0x12a1f' />
Invoke-RestMethod -Uri $spectrumHost -Credential $Credential -Body $xml -ContentType "application/xml" -Method Post
Now I want to extend this with a landscape filter.
Can somebody tell me what to add ?
I already tried http://IP_SPECTRUM/spectrum/restful/model?landscape=0x4.... but with the GET Tunneling this parameter is ignored.
I hope someone can help me
sorry I have not all the code on this current notebook, but lets explain it a bit.
1. You could combine different methods to fetch and filter the searched models.
Why not filtering by Modeltype and Modelhandle or other attributes?
.. some filters
I have once build a filter where I searched for the model-handles in the range of the possible modelhandles of a landscape. .. it worked but was not buitiful from the development-side. .. in this case I was able to use the integer-values or the hex-values... long time ago.
.. yes, If You use Post, then You cannot add GET-Parameters.
I tried same ...
This is what I use to limit landscape scope within a query. Make sure this is surrounded with an AND tag.
e.g. model handle is "greater than 0x400000" and "less than 0x4fffff".
Yes sadly there is no way to specify landscape handles. You have to use the ModelHandle as explained by lutelewis. This is how I do it as well.
If have have specific landscapes in-between others, you have to specify the upper and lower ranges of model handles for each landcape.
For the range of models on a landscape it is:
Landscape handle (start of models)
Landscape handle with last 5 characters changed to 5 'f's ('fffff')
eg. Landscape 0x100000 has models up to '0x1fffff', and
Landscape 0x2a00000 contains models up to '0x2afffff'.
You could as well put the models you are interested in, in a Global Collection (where you can easily filter on the landscape), and then get the content of the Global Collection with the REST API, with something like:
<?xml version="1.0" encoding="UTF-8"?>
xmlns:rs="http://www.ca.com/spectrum/restful/schema/request" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ca.com/spectrum/restful/schema/request ../../../xsd/Request.xsd ">
<has-substring><attribute id="0x12adb"> <value>$GLOBAL_COLLECTION_NAME</value> </attribute></has-substring>
<rs:requested-attribute id="0x12a1f" />