getCreditBalance
Get your current WinSMS credit balance
Get the current remaining credit balance for the account. ***Note*** - The credit balance is expressed as a value with a single decimal place.
/credits/balance
Usage and SDK Samples
curl -X GET -H "AUTHORIZATION: [[apiKey]]" "https://www.winsms.co.za/api/rest/v1/credits/balance"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CreditsApi;
import java.io.File;
import java.util.*;
public class CreditsApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: APIKeyHeader
ApiKeyAuth APIKeyHeader = (ApiKeyAuth) defaultClient.getAuthentication("APIKeyHeader");
APIKeyHeader.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyHeader.setApiKeyPrefix("Token");
CreditsApi apiInstance = new CreditsApi();
try {
creditBalanceResponse result = apiInstance.getCreditBalance();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CreditsApi#getCreditBalance");
e.printStackTrace();
}
}
}
import io.swagger.client.api.CreditsApi;
public class CreditsApiExample {
public static void main(String[] args) {
CreditsApi apiInstance = new CreditsApi();
try {
creditBalanceResponse result = apiInstance.getCreditBalance();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CreditsApi#getCreditBalance");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: APIKeyHeader)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"AUTHORIZATION"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"AUTHORIZATION"];
CreditsApi *apiInstance = [[CreditsApi alloc] init];
// Get your current WinSMS credit balance
[apiInstance getCreditBalanceWithCompletionHandler:
^(creditBalanceResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var Winsms = require('winsms');
var defaultClient = Winsms.ApiClient.instance;
// Configure API key authorization: APIKeyHeader
var APIKeyHeader = defaultClient.authentications['APIKeyHeader'];
APIKeyHeader.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyHeader.apiKeyPrefix['AUTHORIZATION'] = "Token"
var api = new Winsms.CreditsApi()
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.getCreditBalance(callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class getCreditBalanceExample
{
public void main()
{
// Configure API key authorization: APIKeyHeader
Configuration.Default.ApiKey.Add("AUTHORIZATION", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("AUTHORIZATION", "Bearer");
var apiInstance = new CreditsApi();
try
{
// Get your current WinSMS credit balance
creditBalanceResponse result = apiInstance.getCreditBalance();
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling CreditsApi.getCreditBalance: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: APIKeyHeader
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('AUTHORIZATION', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('AUTHORIZATION', 'Bearer');
$api_instance = new Swagger\Client\Api\CreditsApi();
try {
$result = $api_instance->getCreditBalance();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling CreditsApi->getCreditBalance: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CreditsApi;
# Configure API key authorization: APIKeyHeader
$WWW::SwaggerClient::Configuration::api_key->{'AUTHORIZATION'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::SwaggerClient::Configuration::api_key_prefix->{'AUTHORIZATION'} = "Bearer";
my $api_instance = WWW::SwaggerClient::CreditsApi->new();
eval {
my $result = $api_instance->getCreditBalance();
print Dumper($result);
};
if ($@) {
warn "Exception when calling CreditsApi->getCreditBalance: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: APIKeyHeader
swagger_client.configuration.api_key['AUTHORIZATION'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['AUTHORIZATION'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.CreditsApi()
try:
# Get your current WinSMS credit balance
api_response = api_instance.get_credit_balance()
pprint(api_response)
except ApiException as e:
print("Exception when calling CreditsApi->getCreditBalance: %s\n" % e)
Parameters
Responses
Status: 200 - OK
{timeStamp=20170120152253514, version=1.0, statusCode=200, creditBalance=3645}
Status: 401 - Unauthorized
{timeStamp=20170120152253514, version=1.0, statusCode=401, errorMessage=The 'AUTHORIZATION' header was not found. Set the 'AUTHORIZATION' request header to your WinSMS API Key}
Status: 404 - Not found
{timeStamp=20170120152253514, version=1.0, statusCode=404, errorMessage=The resource requested does not exist. Please verify the path, spelling, and capitalisation}
Status: 405 - Method Not Allowed
{timeStamp=20170120152253514, version=1.0, statusCode=405, errorMessage=Request method should be set to 'GET', not 'PUT'.}
Status: 500 - Internal Server Error
{timeStamp=20170120152253514, version=1.0, statusCode=500, errorMessage=An unknown error has occurred - authorising API Key}