To convert an API endpoint monitor to a SoapUI monitor, send a PATCH request to /monitors/website-api/{id}/convert-api
or /monitors/website-ssl-api/{id}/convert-api
, where {id}
is the monitor ID.
This action cannot be reverted. |
Request URL
POST https://api.alertsite.com/api/v3/monitors/website-api/{id}/convert-api
-- or --
POST https://api.alertsite.com/api/v3/monitors/website-ssl-api/{id}/convert-api
Authentication
The request must include the Authorization
header containing a user’s access token:
Authorization: Bearer ACCESS_TOKEN
See Authentication for more information.
Response body
On success, the operation returns the ID of the converted monitor.
{
"id": "123456"
}
Error responses have a non-200 status code and contain the errors
list, such as:
{
"errors": [
{
"code": 400,
"message": "invalid_request - User authentication failed."
}
]
}
Try it out
You can test the operations in AlertSite’s interactive API console:
Code examples
Convert the monitor with ID 123456:
cURL
curl -X PATCH https://api.alertsite.com/api/v3/monitors/website-api/123456/convert-api -H "Authorization: Bearer ACCESS_TOKEN"
Python
import requests # Requests library http://docs.python-requests.org
import json
baseUrl = 'https://api.alertsite.com/api/v3'
username = '[email protected]' # Replace with your AlertSite login email
password = 'pa55w0rd' # Replace with your AlertSite password
monitor_id = 123456
# Login
payload = {'username': username, 'password': password}
r = requests.post(baseUrl + '/access-tokens', data=json.dumps(payload), headers={'Content-Type': 'application/json'})
token = r.json()['access_token']
# Convert the monitor
r = requests.patch(baseUrl + '/monitors/website-api/{}/convert-api'.format(monitor_id), headers={'Authorization': 'Bearer ' + token})
if r.ok:
print('Monitor {} has been converted.'.format(monitor_id))
else:
print('Could not convert monitor {}. The following error(s) occurred:'.format(monitor_id), *r.json()['errors'], sep='\n')
See Also
Monitor Operations
Create an API Endpoint Monitor
Edit an API Endpoint Monitor
Converting API Endpoint Monitors to SoapUI
Delete Monitor