Accessing iTop via Rest API
- In python, do
import requests
d = {'auth_user': <username>,
'auth_pwd': <password>,
'version': '1.3',
'json_data': '{"operation": "list_operations"}'
}
r = requests.post('<url>/webservices/rest.php', data = d)
r.json()
- Note: json_data is a stringified dictionary ('') or use
json.dumps(<dictionary>) - Other examples of json_data:
{
"operation": "core/get",
"class": "Person",
"key": "SELECT Person WHERE email LIKE '%.com'",
"output_fields": "friendlyname, email"
}
{
"operation": "core/get",
"class": "Person",
"key": 1,
"output_fields": "*"
}
{
"operation": "core/get",
"class": "Incident",
"key":
{
"friendlyname": "I-029616"
},
"output_fields": "*"
}
{
"operation": "core/get",
"class": "Incident",
"key":"SELECT Incident WHERE id > 29605",
"output_fields": "start_date, title, description"
}