If you have already voted for an idea, you can undo the vote by sending a request to the web address of the idea posting. Here's one easy way to do it with an asynchronous HTTP (Ajax) request using jQuery.
IBM Connections 4 documentation link: Unvote an idea
Atom API Request Details
|Response||Status Code: 204 No Content|
Example using jQuery
Note: console.log can throw errors in IE, they are there for illustrative purposes only and should be changed as required.