VoIP Spear API - Endpoints

Commands

Action URL Method
List your endpoints /users/{user_id}/endpoints GET
Show info for an endpoint /users/{user_id}/endpoints/{endpoint_id} GET
Create a new endpoint /users/{user_id}/endpoints POST
Update an endpoint /users/{user_id}/endpoints/{endpoint_id} PUT
Delete/cancel endpoint /users/{user_id}/endpoints/{endpoint_id} DELETE
Re-activate a cancelled endpoint /users/{user_id}/endpoints/{endpoint_id}/activate PUT

Endpoint Fields

id
An integer that uniquely identifies the endpoint.
name
The name of the endpoint.
description
A description of the endpoint.
ip-address
The IP address or domain of the endpoint.
created-at
The date and time the endpoint was created.
deleted-at
The date and time the endpoint was cancelled. If this is nil, then the endpoint has not been deleted/cancelled yet.

List your endpoints

GET http://voipspear.com/users/{user_id}/endpoints

By default, this returns all active endpoints for your account. However, you can use the following parameters to constrain the search.

name
The name of the endpoint. This is a case-insensitive partial match.
ip_address
The IP address address of the endpoint. This is a case-insensitive partial match.
deleted
If this parameter is included, the list of endpoints will include deleted/cancelled endpoints.

Some examples of this would be:
GET http://voipspear.com/users/{user_id}/endpoints?name=server
GET http://voipspear.com/users/{user_id}/endpoints?deleted
GET http://voipspear.com/users/{user_id}/endpoints?deleted&ip_address=127.0.0.1

Example

curl -u username:password -H 'Accept: text/xml' \
  -i -X GET http://voipspear.com/users/63/endpoints

HTTP/1.1 200 OK
Connection: close
Date: Mon, 19 Jan 2009 17:07:24 GMT
Status: 200 OK
Server: Mongrel 1.1.4
Content-Type: application/xml; charset=utf-8
Content-Length: 762

<?xml version="1.0" encoding="UTF-8"?>
<endpoints type="array">
  <endpoint>
    <created-at type="datetime">2009-01-14T05:07:26Z</created-at>
    <deleted-at type="datetime" nil="true"></deleted-at>
    <description nil="true"></description>
    <id type="integer">35</id>
    <ip-address>127.0.0.1</ip-address>
    <is-server type="boolean">false</is-server>
    <name>Test endpoint</name>
  </endpoint>
  <endpoint>
    <created-at type="datetime">2009-01-14T05:07:54Z</created-at>
    <deleted-at type="datetime" nil="true"></deleted-at>
    <description nil="true"></description>
    <id type="integer">36</id>
    <ip-address>127.0.0.2</ip-address>
    <is-server type="boolean">false</is-server>
    <name>Test endpoint2</name>
  </endpoint>
</endpoints>

Show info for an endpoint

GET http://voipspear.com/users/{user_id}/endpoints/{endpoint_id}

Example

curl -u username:password -H 'Accept: text/xml' \
  -i -X GET http://voipspear.com/users/63/endpoints/36

HTTP/1.1 200 OK
Connection: close
Date: Mon, 19 Jan 2009 17:09:55 GMT
Status: 200 OK
Server: Mongrel 1.1.4
Content-Type: application/xml; charset=utf-8
Content-Length: 364

<?xml version="1.0" encoding="UTF-8"?>
<endpoint>
  <created-at type="datetime">2009-01-14T05:07:54Z</created-at>
  <deleted-at type="datetime" nil="true"></deleted-at>
  <description nil="true"></description>
  <id type="integer">36</id>
  <ip-address>127.0.0.2</ip-address>
  <is-server type="boolean">false</is-server>
  <name>Test endpoint2</name>
</endpoint>

Create new endpoint

POST http://voipspear.com/users/{user_id}/endpoints %>

Response Code: 201 Created

When you create an endpoint, you should expect that the response code is "201 Created" rather than the usual "200 OK". Also note that the response headers also include the location/URL of the newly created endpoint. And don't forget: after you create an endpoint, you must create VoIP tests for it. Otherwise, none of the servers will test to the new endpoint.

Here are the fields you can specify when creating an endpoint.

name
The name of this endpoint. The endpoint's name can be whatever you please and there are no restrictions on the characters you can use.
ip_address
The IP address of the endpoint, or a domain name that VoIP Spear resolves to an IP address.
description
A description for the endpoint. The endpoint's description can be whatever you please and there are no restrictions on the characters you can use.

Example

curl -u username:password -H 'Accept: text/xml' -H 'Content-type: application/xml' \
  -d 'Test endpoint127.0.0.1' \
  -i -X POST http://voipspear.com/users/63/endpoints

HTTP/1.1 201 Created
Connection: close
Date: Mon, 19 Jan 2009 17:12:55 GMT
Status: 201 Created
Location: http://voipspear.com/users/63/endpoints/38
Server: Mongrel 1.1.4
Content-Type: application/xml; charset=utf-8
Content-Length: 363

<?xml version="1.0" encoding="UTF-8"?>
<endpoint>
  <created-at type="datetime">2009-01-19T17:12:56Z</created-at>
  <deleted-at type="datetime" nil="true"></deleted-at>
  <description nil="true"></description>
  <id type="integer">38</id>
  <ip-address>127.0.0.1</ip-address>
  <is-server type="boolean">false</is-server>
  <name>Test endpoint</name>
</endpoint>

Update an endpoint

PUT http://voipspear.com/users/{user_id}/endpoints/{endpoint_id}

The fields you may specify when updating an endpoint are similar to creating a new endpoint. The only difference is that you cannot change the IP address of the endpoint after it is created.

name
The name of this endpoint. The endpoint's name can be whatever you please and there are no restrictions on the characters you can use.
description
A description for the endpoint. The endpoint's description can be whatever you please and there are no restrictions on the characters you can use.

Example

curl -u username:password -H 'Accept: text/xml' -H 'Content-type: application/xml' \
  -d 'Endpoint name127.0.0.1' \
  -i -X PUT http://voipspear.com/users/63/endpoints/38

HTTP/1.1 200 OK
Connection: close
Date: Mon, 19 Jan 2009 17:19:58 GMT
Status: 200 OK
Server: Mongrel 1.1.4
Content-Type: application/xml; charset=utf-8
Content-Length: 363

<?xml version="1.0" encoding="UTF-8"?>
<endpoint>
  <created-at type="datetime">2009-01-19T17:12:56Z</created-at>
  <deleted-at type="datetime" nil="true"></deleted-at>
  <description nil="true"></description>
  <id type="integer">38</id>
  <ip-address>127.0.0.1</ip-address>
  <is-server type="boolean">false</is-server>
  <name>Endpoint name</name>
</endpoint>

Delete an endpoint

DELETE http://voipspear.com/users/{user_id}/endpoints/{endpoint_id}

Deleting an endpoint does not remove it from the system entirely. Instead, it goes into an inactive state. This is why we prefer to use the term "cancelled" as opposed to "deleted." Note that you are able to re-activate a deleted/cancelled endpoint later on.

Inactive endpoints are not monitored by the servers.

Example

curl -u username:password -H 'Accept: text/xml' -H 'Content-type: application/xml' \
  -i -X DELETE http://voipspear.com/users/8/endpoints/12

HTTP/1.1 200 OK
Connection: close
Date: Mon, 19 Jan 2009 20:25:24 GMT
Status: 200 OK
Server: Mongrel 1.1.4
Content-Type: application/xml; charset=utf-8
Content-Length: 369

<?xml version="1.0" encoding="UTF-8"?>
<endpoint>
  <created-at type="datetime">2008-01-01T00:00:00Z</created-at>
  <deleted-at type="datetime">2009-01-19T20:25:24Z</deleted-at>
  <description nil="true"></description>
  <id type="integer">12</id>
  <ip-address>127.0.0.1</ip-address>
  <is-server type="boolean">false</is-server>
  <name>New York City voice gateway</name>
</endpoint>

Re-activate a cancelled endpoint

PUT http://voipspear.com/users/{user_id}/endpoints/{endpoint_id}/activate

Example

curl -u username:password -H 'Accept: text/xml' -H 'Content-type: application/xml' \
  -i -X PUT http://voipspear.com/users/8/endpoints/12/activate

HTTP/1.1 200 OK
Date: Mon, 19 Jan 2009 20:33:05 GMT
Status: 200 OK
Server: Mongrel 1.1.4
Content-Type: application/xml; charset=utf-8
Content-Length: 360

<?xml version="1.0" encoding="UTF-8"?>
<endpoint>
  <created-at type="datetime">2008-01-01T00:00:00Z</created-at>
  <deleted-at type="datetime" nil="true"></deleted-at>
  <description nil="true"></description>
  <id type="integer">12</id>
  <ip-address>127.0.0.1</ip-address>
  <is-server type="boolean">false</is-server>
  <name>New York City voice gateway</name>
</endpoint>