Check to see that you can access the API by querying the root URL (i.e., https://voipspear.com). You will receive a "200 OK" response similar to the one below.
For the purposes of this test, you can use curl.
curl -X GET https://voipspear.com/api/v3.1 -H "Accept: application/json" -H "Content-Type: application/json"{ "message": "VoIP Spear API: Property of Toepoke Software, Inc. All rights reserved. For more information, refer to www.voipspear.com." }
All requests to the API must have the path prefix /api/v3.1 prepended to them.
Thus, when you see a path like /endpoints/3 in the documentation, the real path to use for your
requests is /api/v3.1/endpoints/3.
Except for the root URL, you must authenticate on every API request. VoIP Spear uses Basic authentication using your account's username and password.
You must create a dedicated user account to access the VoIP Spear API; only user accounts having a category of "API" will be authorized to send API requests.
You can check to see if you are able to authenticate to the API by requesting
/my_account. In the example below, we are able to successfully authenticate
using curl. If we were unable to authenticate, we would receive a "401 Unauthorized" response.
curl -X GET https://voipspear.com -u <username>:<password> -H "Accept: application/json" -H "Content-Type: application/json"
{
"me": {
"id": 11427,
"username": "apiuser",
"name": "Ryan",
"master": false,
"email": "api@toepoke.com",
"category": "API",
"created_at": "2017-04-15T16:20:42Z",
"deleted_at": null
},
"master_account": {
"id": 11426,
"username": "api",
"name": "API Test",
"master": true,
"email": "api@toepoke.com",
"category": "Admin",
"created_at": "2017-04-15T16:17:35Z",
"deleted_at": null
},
"plan": {
"id": 19,
"name": "Pro",
"price": {
"amount": 25.95,
"currency": "USD"
},
"num_monitorables": 5,
"num_users": 5,
"num_servers": 3,
"testing_frequency": 1,
"archive_duration": 7,
"alerts": true,
"api_access": true,
"advanced_testing": false,
"private": false
}
}
Once you are able to authenticate, you can get started. Proceed to the next section where you will learn to manage your user accounts.