API Services - Balance
Returns how many points the user has left in their balance.


URL

https://api.proxstop.com/balance.format


Formats

json, xml


HTTP Methods

GET, POST


Request Data

Required Variable Example Info
Yes key 098f6bcd4621d373cade4e832627b4f6 Your unique API key


Example Request

https://api.proxstop.com/balance.xml?key=098f6bcd4621d373cade4e832627b4f6


Response Data

Variable Example Info
balance 124 This will contain how many points the user has left in their balance.


Good Response Example

<?xml version="1.0" encoding="UTF-8"?>
<response>
	<balance>124</balance>
</response>		
{
	"version": "1.0",
	"encoding": "UTF-8",
	"response": {
		"balance": 124
	}
}		


Bad Response Example

<?xml version="1.0" encoding="UTF-8"?>
<failed>
	<error_code>INVALID_KEY</error_code>
	<error_msg>The API key provided is not valid.</error_msg>
</failed>		
{
	"version": "1.0",
	"encoding": "UTF-8",
	"failed": {
		"error_code": "INVALID_KEY",
		"error_msg": "The API key provided is not valid."
	}
}		


Simple Programming Example

This uses our PHP5 class which can be downloaded by clicking here. The downloadable zip archive will also contain more detailed examples with forms.

// Load config & main class
require_once('config.ProxStop.php');

// Perform Lookup
$result = $ProxStop->balance();

// The lookup failed, print the error message.
if($result===false)
{
	echo 'The lookup failed with the error "'.$ProxStop->errors['code'].': '.$ProxStop->errors['msg'].'"';
}

// Lets show the result since lookup was good.
else
{
	echo 'Your ProxStop Balance: '.$result->balance.' Points';
}		
$apiUrl = 'https://api.proxstop.com/balance.xml';
$apiKey = '098f6bcd4621d373cade4e832627b4f6'; // Replace with your API key

$result = file_get_contents($apiUrl.'?key='.$apiKey);
$result = simplexml_load_string($result);

if(isset($result->error_code))
{
	echo 'The lookup failed with the error "'.$result->error_code.': '.$result->error_msg.'"';
}
else if(!isset($result->balance))
{
	echo 'The service seems to be temporarily unavailable.';
}
else
{
	// Do what you need here
}		
string apiUrl = "https://api.proxstop.com/balance.xml";
string apiKey = "098f6bcd4621d373cade4e832627b4f6"; // Replace with your API key

string results = new System.Net.WebClient().DownloadString(apiUrl+"?key="+apiKey);
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.LoadXml(results);

if(doc.SelectSingleNode("//failed/error_code")!=null)
{
	Response.Write("The lookup failed with the error \""+doc.SelectSingleNode("//failed/error_code/text()").Value+": "+doc.SelectSingleNode("//failed/error_msg/text()").Value+"\"");
}
else if(doc.SelectSingleNode("//response/balance")==null)
{
	Response.Write("The service seems to be temporarily unavailable.");
}
else
{
	// Do what you need here
}		
require 'net/http'
require 'rexml/document'

apiUrl = 'https://api.proxstop.com/balance.xml'
apiKey = '098f6bcd4621d373cade4e832627b4f6' #Replace with your API key

xml_data = Net::HTTP.get_response(URI.parse(apiUrl+'?key='+apiKey)).body
doc = REXML::Document.new(xml_data)

if doc.elements['failed/error_code']
	print 'The lookup failed with the error '+doc.elements['failed/error_code'].text+': '+doc.elements['failed/error_msg'].text

elsif !doc.elements['response/balance']
	print 'The service seems to be temporarily unavailable.'

else
	#Do what you need here

end		
from urllib.request import urlopen
from xml.dom import minidom

apiUrl = 'https://api.proxstop.com/balance.xml'
apiKey = '098f6bcd4621d373cade4e832627b4f6' #Replace with your API key

dom = minidom.parse(urlopen(apiUrl+'?key='+apiKey))

if (dom.getElementsByTagName('error_code')):
	print (dom.getElementsByTagName('error_code')[0].firstChild.data+': '+dom.getElementsByTagName('error_msg')[0].firstChild.data)

elif not (dom.getElementsByTagName('response')):
	print ('The service seems to be temporarily unavailable.')

else:
	#Do what you need here
	print ('Success')		
const http = require('http');

var apiHost = 'api.proxstop.com';
var apiPath = '/balance.json';
var apiKey = '098f6bcd4621d373cade4e832627b4f6'; //Replace with your API key

http.get({host:apiHost,port:80,path:apiPath+'?key='+apiKey,agent:false},function(res){
	res.setEncoding('utf8');
	res.on('data',function(chunk){
		var json = JSON.parse(chunk);
		if(json.failed!=undefined) {
			console.log(json.failed.error_code+': '+json.failed.error_msg);
		} else if(json.response==undefined) {
			console.log('The service seems to be temporarily unavailable.');
		} else {
			//Do what you need here
			console.log('Success');
		}
	});
});		
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import java.io.File;

public class ProxStop {
	public static void main(String[] args) {

		String apiUrl = "https://api.proxstop.com/balance.xml";
		String apiKey = "098f6bcd4621d373cade4e832627b4f6"; //Replace with your API key

		try {
			DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
			DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
			Element docEle = dBuilder.parse(apiUrl+"?key="+apiKey).getDocumentElement();

			if (docEle.getNodeName()=="failed") {
				System.out.println(docEle.getElementsByTagName("error_code").item(0).getChildNodes().item(0).getNodeValue()+": "+docEle.getElementsByTagName("error_msg").item(0).getChildNodes().item(0).getNodeValue());
			} else if (docEle.getNodeName()!="response") {
				System.out.println("The service seems to be temporarily unavailable.");
			} else {
				//Do what you need here
				System.out.println("Success.");
			}
		} catch (SAXParseException err) {
		} catch (SAXException e) {
		} catch (Throwable t) {
		}
	}
}		


Price

Free