-
API DOCUMENTATION
GETTING STARTED -
MESSAGES
- POSTSend a Message
-
NUMBER MANAGEMENT
- GETActive Numbers
- GETSearch Numbers
- POSTGet a Number
-
ACCOUNT
- GETGet Balance
-
TEST METHODS
- GETPing
-
CALLBACK EVENTS
- POSTInbound Message
- POSTDelivery Receipt
Get Current Account Balance/v1/account/balance
Description
Gets the current balance for the associated account.
GET
Endpoint
https://api.textport.com/v1/account/balance
Request
GET /v1/account/balance HTTP/1.1
Host: api.textport.com
Authorization: Basic MS13OFBHczdPY09KOkVnbkJDZnh5N2txMXdHVkpycFJn
var client = new RestClient("https://api.textport.com/v1/account/balance");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Basic MS13OFBHczdPY09KOkVnbkJDZnh5N2txMXdHVkpycFJn");
IRestResponse response = client.Execute(request);
$request = new HttpRequest();
$request->setUrl('https://api.textport.com/v1/account/balance');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Authorization' => 'Basic MS13OFBHczdPY09KOkVnbkJDZnh5N2txMXdHVkpycFJn'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
curl -X GET \
https://api.textport.com/v1/account/balance \
-H 'Authorization: Basic MS13OFBHczdPY09KOkVnbkJDZnh5N2txMXdHVkpycFJn'
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.textport.com/v1/account/balance",
"method": "GET",
"headers": {
"Authorization": "Basic MS13OFBHczdPY09KOkVnbkJDZnh5N2txMXdHVkpycFJn"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
import http.client
conn = http.client.HTTPConnection("api,textport,com")
payload = ""
headers = {
'Authorization': "Basic MS13OFBHczdPY09KOkVnbkJDZnh5N2txMXdHVkpycFJn"
}
conn.request("GET", "v1,account,balance", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.textport.com/v1/account/balance")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic MS13OFBHczdPY09KOkVnbkJDZnh5N2txMXdHVkpycFJn'
response = http.request(request)
puts response.read_body
{
"UserName": "apidemo",
"Balance": 9.415
}
<BalanceResult>
<UserName>apidemo</UserName>
<Balance>9.415</Balance>
</BalanceResult>
Note: The default format for response content is JSON. Adding an HTTP header Accept: application/xml will set the response format to XML.