API Request Insightvm

I am trying to create an asset group with the API for insightvm. Had a quick question on syntax. So filters I am trying to create this off of is ip-address, in range, value. Below is the call but it does not seem to work. Hoping someone could let me know how to set it up correctly.
{“field”: “ip-address”, “operator”: “in range”, “value”: “x.x.x.x” “to” “x.x.x.x”}

Thanks in advance,
Jacob

1 Like

What kind of error are you seeing when making the API call? It would also help to see the URL and full payload that you’re sending.

I was just looking at the Search Criteria here and it looks like your operator field should be in-range (with the dash in between).

Looking at the docs some more, I see it mentions an upper and lower field. So maybe you could try something along these lines:

{ 
   "field": "ip-address", 
   "operator": "in-range", 
   "lower": "<value>",
   "upper": "<value>"
}

Hi Holly,

I know my payload with the URL works, because I used the example in the API documentation:
“operating-system”, “operator”: “contains”, “value”: “linux”. and it created it in the console

My Full paylod is:
{

    "Description": "",

    "name": "",

    "searchCriteria": {

        "filters": [

            {"field": "ip-address", "operator": "in-range", "value": "x.x.x.x" "to" "x.x.x.x"}

        ],

        "match": "all"

    },

    "type": "dynamic"

}

)
The error code that I am getting is:
400
Bad Request

Yes, Thank you molly the lower and upper worked!

1 Like