Commands
| Action | URL | Method |
|---|---|---|
| List the VoIP tests for an endpoint | /users/{user_id}/endpoints/{endpoint_id}/voip_tests | GET |
| Show info for a VoIP test | /users/{user_id}/endpoints/{endpoint_id}/voip_tests/{voip_test_id} | GET |
| Create a new VoIP test for an endpoint | /users/{user_id}/endpoints/{endpoint_id}/voip_tests | POST |
| Update a VoIP test | /users/{user_id}/endpoints/{endpoint_id}/voip_tests/{voip_test_id} | PUT |
| Delete/cancel a VoIP test | /users/{user_id}/endpoints/{endpoint_id}/voip_tests/{voip_test_id} | DELETE |
| Re-activate a cancelled/deleted VoIP test | /users/{user_id}/endpoints/{endpoint_id}/voip_tests/{voip_test_id}/activate | DELETE |
VoIP Test Fields
- id
- An integer that uniquely identifies the VoIP test.
- endpoint-id
- The ID of the endpoint this VoIP test belongs to.
- server-id
- The ID of the server doing the testing.
- mos
- The current MOS value for this VoIP test. Use the "updated-at" field to see how recent this value is.
- codec
- The codec being used for the VoIP test.
- alert-threshold
- A number between 1 and 5 indicating the point at which VoIP Spear should send out alerts for this VoIP test. Alerts are sent out when the MOS results for this VoIP test are below the alert threshold for a certain amount of time. The amount of time is defined by how the alerts are set up. To get this information, log into your account on the web site.
- alerting-since
- If the VoIP test is alerting (meaning that the MOS is below the "alert-threshold" value for a particular amount of time), this will show you the time at which it first dropped below the threshold. If this value is nil, the VoIP test is not alerting.
- created-at
- The date and time the VoIP test was created.
- deleted-at
- The date and time the VoIP test was cancelled. If this is nil, then the VoIP test has not been deleted/cancelled yet.
- updated-at
- The date and time the VoIP test was last updated.
List the VoIP tests for an endpoint
GET http://voipspear.com/users/{user_id}/endpoints/{endpoint_id}/voip_tests
In contrast to a listing of users and endpoints, a listing of VoIP tests includes both active and deleted/cancelled VoIP tests.
Example
curl -u username:password -H 'Accept: text/xml' -H 'Content-type: application/xml' \
-i -X GET http://voipspear.com/users/63/endpoints/35/voip_tests
HTTP/1.1 200 OK
Connection: close
Status: 200 OK
Server: Mongrel 1.1.4
Content-Type: application/xml; charset=utf-8
Content-Length: 1181
<?xml version="1.0" encoding="UTF-8"?>
<voip-tests type="array">
<voip-test>
<alert-threshold type="float" nil="true"></alert-threshold>
<alerting-since type="datetime" nil="true"></alerting-since>
<codec>g729</codec>
<created-at type="datetime">2009-01-06T05:51:01Z</created-at>
<deleted-at type="datetime" nil="true"></deleted-at>
<endpoint-id type="integer">35</endpoint-id>
<id type="integer">46</id>
<mos type="float" nil="true"></mos>
<server-id type="integer">2</server-id>
<updated-at type="datetime">2009-01-07T18:11:10Z</updated-at>
</voip-test>
<voip-test>
<alert-threshold type="float" nil="true"></alert-threshold>
<alerting-since type="datetime" nil="true"></alerting-since>
<codec>g729</codec>
<created-at type="datetime">2009-01-19T20:42:50Z</created-at>
<deleted-at type="datetime" nil="true"></deleted-at>
<endpoint-id type="integer">35</endpoint-id>
<id type="integer">51</id>
<mos type="float" nil="true"></mos>
<server-id type="integer">1</server-id>
<updated-at type="datetime">2009-01-19T20:42:50Z</updated-at>
</voip-test>
</voip-tests>
Show info for a VoIP test
GET http://voipspear.com/users/{user_id}/endpoints/{endpoint_id}/voip_tests/{voip_test_id}
Example
curl -u username:password -H 'Accept: text/xml' -H 'Content-type: application/xml' \
-i -X GET http://voipspear.com/users/63/endpoints/35/voip_tests/46
HTTP/1.1 200 OK
Connection: close
Date: Mon, 19 Jan 2009 21:16:52 GMT
Status: 200 OK
Server: Mongrel 1.1.4
Content-Type: application/xml; charset=utf-8
Content-Length: 566
<?xml version="1.0" encoding="UTF-8"?>
<voip-test>
<alert-threshold type="float" nil="true"></alert-threshold>
<alerting-since type="datetime" nil="true"></alerting-since>
<codec>g729</codec>
<created-at type="datetime">2009-01-06T05:51:01Z</created-at>
<deleted-at type="datetime" nil="true"></deleted-at>
<endpoint-id type="integer">35</endpoint-id>
<id type="integer">46</id>
<mos type="float" nil="true"></mos>
<server-id type="integer">2</server-id>
<updated-at type="datetime">2009-01-07T18:11:10Z</updated-at>
</voip-test>
Create a new VoIP test for an endpoint
POST http://voipspear.com/users/{user_id}/endpoints/{endpoint_id}/voip_tests %>
Response Code: "201 Created" or "200 OK"
When you create a new VoIP test, VoIP Spear looks to see if there's an deleted/cancelled VoIP test between this server and endpoint. If there it, then it just re-activates that VoIP test instead of creating a new one. The reason we do this is because the historical test results are preserved this way.
If a new VoIP test is created, the response code will be "201 Created" rather than the usual "200 OK". Also note that the response headers will also include the location/URL of the newly created VoIP test in this case. If an old VoIP test is re-activated as a result of this request, the response code will be "200 OK".
Here are the fields you can specify when creating a VoIP test.
- server_id
- Identifies the server that will be doing the testing for this VoIP test.
- alert_threshold
- This is a number between 1 and 5 indicating the point at which VoIP Spear should send out alerts for this VoIP test. Alerts are sent out when the MOS results for this VoIP test are below the alert threshold for a certain amount of time. The amount of time is defined by how the alerts are set up. To get this information, log into your account on the web site.
- codec
- The codec that VoIP Spear will use for this VoIP test. This must be one of 'g711', 'g729', or 'g723'.
curl -u username:password -H 'Accept: text/xml' -H 'Content-type: application/xml' \
-d '<voip_test><server_id>1</server_id><codec>g729</codec></voip_test>' \
-i -X POST http://voipspear.com/users/63/endpoints/35/voip_tests
HTTP/1.1 201 Created
Connection: close
Date: Mon, 19 Jan 2009 20:42:50 GMT
Status: 201 Created
Location: http://voipspear.com/users/63/endpoints/35/voip_tests/51
Server: Mongrel 1.1.4
Content-Type: application/xml; charset=utf-8
Content-Length: 566
<?xml version="1.0" encoding="UTF-8"?>
<voip-test>
<alert-threshold type="float" nil="true"></alert-threshold>
<alerting-since type="datetime" nil="true"></alerting-since>
<codec>g729</codec>
<created-at type="datetime">2009-01-19T20:42:50Z</created-at>
<deleted-at type="datetime" nil="true"></deleted-at>
<endpoint-id type="integer">35</endpoint-id>
<id type="integer">51</id>
<mos type="float" nil="true"></mos>
<server-id type="integer">1</server-id>
<updated-at type="datetime">2009-01-19T20:42:50Z</updated-at>
</voip-test>
Update a VoIP test
PUT http://voipspear.com/users/{user_id}/endpoints/{endpoint_id}/voip_tests/{voip_test_id}
The fields you may specify when updating a VoIP test are similar to creating a new VoIP test. The only difference is that you cannot change the server of the VoIP test.
- alert_threshold
- This is a number between 1 and 5 indicating the point at which VoIP Spear should send out alerts for this VoIP test. Alerts are sent out when the MOS results for this VoIP test are below the alert threshold for a certain amount of time. The amount of time is defined by how the alerts are set up. To get this information, log into your account on the web site.
- codec
- The codec that VoIP Spear should use for this VoIP test. This must be one of 'g711', 'g729', or 'g723'.
Example
curl -u username:password -H 'Accept: text/xml' -H 'Content-type: application/xml' \
-d '<voip_test><codec>g711</codec></voip_test>' -i -X PUT http://voipspear.com/users/63/endpoints/35/voip_tests/46
HTTP/1.1 200 OK
Connection: close
Date: Mon, 19 Jan 2009 21:20:44 GMT
Status: 200 OK
Server: Mongrel 1.1.4
Content-Type: application/xml; charset=utf-8
Content-Length: 566
<?xml version="1.0" encoding="UTF-8"?>
<voip-test>
<alert-threshold type="float" nil="true"></alert-threshold>
<alerting-since type="datetime" nil="true"></alerting-since>
<codec>g711</codec>
<created-at type="datetime">2009-01-06T05:51:01Z</created-at>
<deleted-at type="datetime" nil="true"></deleted-at>
<endpoint-id type="integer">35</endpoint-id>
<id type="integer">46</id>
<mos type="float" nil="true"></mos>
<server-id type="integer">2</server-id>
<updated-at type="datetime">2009-01-19T21:20:44Z</updated-at>
</voip-test>
Delete a VoIP test
DELETE http://voipspear.com/users/{user_id}/endpoints/{endpoint_id}/voip_tests/{voip_test_id}
Deleting a VoIP test does not remove it from the system entirely. Instead, it goes into an inactive state. We prefer to think of these VoIP tests as "cancelled" rather than "deleted." After a VoIP test has been cancelled, you can re-activate it at any time.
The servers do not run cancelled VoIP tests.
Example
curl -u username:password -H 'Accept: text/xml' -H 'Content-type: application/xml' \
-i -X DELETE http://voipspear/users/63/endpoints/35/voip_tests/46
HTTP/1.1 200 OK
Connection: close
Date: Tue, 20 Jan 2009 05:34:24 GMT
Status: 200 OK
Server: Mongrel 1.1.4
Content-Type: application/xml; charset=utf-8
Content-Length: 575
<?xml version="1.0" encoding="UTF-8"?>
<voip-test>
<alert-threshold type="float" nil="true"></alert-threshold>
<alerting-since type="datetime" nil="true"></alerting-since>
<codec>g711</codec>
<created-at type="datetime">2009-01-06T05:51:01Z</created-at>
<deleted-at type="datetime">2009-01-20T05:32:57Z</deleted-at>
<endpoint-id type="integer">35</endpoint-id>
<id type="integer">46</id>
<mos type="float" nil="true"></mos>
<server-id type="integer">2</server-id>
<updated-at type="datetime">2009-01-20T05:32:57Z</updated-at>
</voip-test>
Re-activate a cancelled VoIP test
PUT http://voipspear.com/users/{user_id}/endpoints/{endpoint_id}/voip_tests/{voip_test_id}/activate
Example
curl -u api2:api2 -H 'Accept: text/xml' -H 'Content-type: application/xml' \
-i -X PUT http://localhost:3000/users/63/endpoints/35/voip_tests/46/activate
HTTP/1.1 200 OK
Connection: close
Date: Tue, 20 Jan 2009 05:35:03 GMT
Status: 200 OK
Server: Mongrel 1.1.4
Content-Type: application/xml; charset=utf-8
Content-Length: 566
<?xml version="1.0" encoding="UTF-8"?>
<voip-test>
<alert-threshold type="float" nil="true"></alert-threshold>
<alerting-since type="datetime" nil="true"></alerting-since>
<codec>g711</codec>
<created-at type="datetime">2009-01-06T05:51:01Z</created-at>
<deleted-at type="datetime" nil="true"></deleted-at>
<endpoint-id type="integer">35</endpoint-id>
<id type="integer">46</id>
<mos type="float" nil="true"></mos>
<server-id type="integer">2</server-id>
<updated-at type="datetime">2009-01-20T05:35:03Z</updated-at>
</voip-test>
