*Update 22nd Jan 2016*: Since the SDK version 3.7.x, you can now optionally use https:// port 32018 in addition to http:// on port 32017! (however for https you may need to manually deploy the self-signed certificate if using Firefox or Java).

Sample code:
Download this sample code as a ZIP
 
String tmpResult =
    RESTConvenienceClass.SendRESTCommand(
    "http://127.0.0.1:32017/Spokes/DeviceServices/Attach?uid=0123456789"
);
This code requires the convenience function SendRESTCommand (available in the sample code ZIP).

0123456789 is a magic uid which tells the REST Service API to attach to the "primary" Plantronics device (primary device is settable via the Plantronics Hub user interface, in the case you have more than one Plantroncis device attached to your PC).

Now we can examine the tmpResult variable to see if the attach was a success.
int pos = tmpResult.indexOf("\"Result\":\"");
if (pos>-1)
{
    tmpResult = tmpResult.substring(pos+10);
    pos = tmpResult.indexOf("\"");
    if (pos>-1)
    {
        tmpResult = tmpResult.substring(0, pos);
        System.out.println("Session id is: " + tmpResult);
        sessionid = tmpResult;
    }
}
This code is extracting the sessionid from the HTTP response. We need that later for some of the other REST Service API commands. Note, the HTTP response is in fact JSON, so it would be better to parse with a JSON parser, but I haven't adopted a suitable JSON parser yet...

After a short delay we can go ahead an register a REST Service API plugin. The plugin is needed for some of the call control commands.
try
{
    Thread.sleep(250);
}
catch (InterruptedException ex)
{
    Logger.getLogger(PlantronicsRESTDemo.class.getName()).log(Level.SEVERE, null, ex);
}                                  
if (sessionid.length()>0)
{
    RESTConvenienceClass.SendRESTCommand(
        "http://127.0.0.1:32017/Spokes/SessionManager/Register?name=My%20Java%20Plugin"
    );               
    pluginRegistered = true;
}
Now we are able to poll for device events using further REST Service API commands, like this:
(Note: the sessid and plugin_name need to match what we registered earlier).
The contents of the responses we get back tell us lots of information, such as when user has answered a call with headset, mutes a call, takes headset off, etc.
RESTConvenienceClass.SendRESTCommand(
    "http://127.0.0.1:32017/Spokes/DeviceServices/Events?sess="
        + sessid
        + "&queue=0"
)
RESTConvenienceClass.SendRESTCommand(
    "http://127.0.0.1:32017/Spokes/CallServices/Events"
);
RESTConvenienceClass.SendRESTCommand(
    "http://127.0.0.1:32017/Spokes/CallServices/SessionManagerCallEvents?name="
        + plugin_name
);
Finally we can control the headset by telling it when we are going on a call, for example:
An incoming call (pass an integer callid, used to refer to this call during its lifecycle, and pass an optional caller name for Plantronics' display device products):
callid = callid + 1;
caller_name = "Bob%20Smith";
RESTConvenienceClass.SendRESTCommand(
    "http://127.0.0.1:32017/Spokes/CallServices/IncomingCall?name=My%20Java%20Plugin&callID=%7B%22Id%22%3A%22"
        + callid
        + "%22%7D&contact=%7B%22Name%22%3A%22"
        + caller_name
        + "%22%7D&tones=Unknown&route=ToHeadset"
);
End the call:
RESTConvenienceClass.SendRESTCommand(
    "http://127.0.0.1:32017/Spokes/CallServices/TerminateCall?name=My%20Java%20Plugin&callID=%7B%22Id%22%3A%22"
        + callid
        + "%22%7D"
);
For more examples and to see a complete Java implementation, download the sample code ZIP.

Here is a screeshot of the sample code in action running under NetBeans IDE:

false

Have fun!