Please help me with a rest api call to run with python, the query is to get the baseline using its name. How to wrap this query to run through python:
(.\iem.exe get query --relevance="(ID of it) of BES Baselines whose (Name of it is “”"""$searchstring""""""")") -replace ‘[\x00-\x1f]’,’’
Thank you!!
You should checkout the examples on the developer site using requests. https://developer.bigfix.com/rest-api/examples/#python
Here is a quick example for your query:
import json
import requests
search_string = input('Search for: ').lower()
r = requests.get(f'https://bigfixServer:52311/api/query?output=json&relevance=(id of it) of bes baselines whose (name of it as string as lowercase contains "{search_string}"', verify=False, auth=('yourusername', 'yourpassword'))
data = json.loads(r.content)
for id in data['result']:
print(f'ID: {id}')
4 Likes
Many Thank You!! It worked for us. 