Create/Update/Delete Tests Using the ThousandEyes API
The ThousandEyes API supports creating, editing, and deleting tests programmatically.
This feature is restricted to users with Account Admin privileges or higher. Users without account admin privileges will receive an HTTP/403 error when attempting to post a write request.
The NEW, UPDATE and DELETE endpoints have been added to each test endpoint. Content must be submitted using a POST request, and all POST requests must contain a "Content-Type: application/JSON" header.
I can then update the same request by modifying the JSON data:
curl https://api.thousandeyes.com/tests/agent-to-server/1586/update.json?authToken=<my_authtoken> \
-d '{"interval": 900, "agents": [{"agentId": 113}], "testName": "this is a new name and interval for my test"}' \
-H "Content-Type:application/json"
Note that only certain fields can be updated in an update request:
interval
testName
agents
{
"test": [
{
"enabled":1,
"testId":1586,
"testName":"this is a new name and interval for my test",
"interval":900,
"server":"www.thousandeyes.com:80",
"agents":[
{
"agentId":113,
"agentName":"Bucharest, Romania",
"location":"Bucuresti, Romania",
"countryId":"RO",
"ipAddress":"89.36.27.146",
"prefix":"89.36.24.0/21",
"network":"HOSTWAY ROMANIA SRL (AS 39756)",
"public":1
}
],
"createdBy":"Dave Fraleigh (dave@thousandeyes.com)",
"createdDate":"2013-06-12 01:22:40",
"modifiedBy":"Dave Fraleigh (dave@thousandeyes.com)",
"modifiedDate":"2013-06-12 02:10:13",
}
]
}
Then, to delete the same test, run the following command: