Test and Monitor Templates
Templates for test and monitor types need to be set up manually through the Routing Active Testing front-end user interface. How to do this is covered in the in-app help under "Tests and monitors" > "Creating templates".
Exporting Test and Monitor Templates
The code below shows how to export a monitor template in JSON format. Export of tests is
similar (just replace monitor_templates with
test_templates in the definition of url).
# Request settings
url = '%s/accounts/%s/monitor_templates/export/' % (args.ncc_url, args.account)
# Export templates
print url
response = requests.get(url=url, headers={'API-Token': args.token})Previously exported monitor templates can be imported back into Control Center as follows (again, test templates are handled analogously):
# Request settings
url = '%s/accounts/%s/monitor_templates/import/' % (args.ncc_url, args.account)
json_data = json.dumps({
"templates": [
{
"input": [
{
"require_bridge": False,Insert the rest of the JSON string here.
"description": "Monitor for HTTP",
"name": "mtpl-2"
}
],
"version": "2.29",
"export_date": "2019-05-16T10:03:37.042474Z"
})
# Import monitor templates
response = requests.post(url=url, data=json_data, headers={
'API-Token': args.token,
'Accept': 'application/json; indent=4',
'Content-Type': 'application/json',
})