API Reference

You can check your account balance by using this API. Permission required for API Key: Balance viewer

Description

Headers

  • Content-Type: The Content-Type header is set to application/json, indicating that the request body contains JSON data.
  • Authorization: The Authorization header is used with a bearer token for authentication. The actual token value should replace the placeholder Bearer eyJhbG...NrEQ41w.

Sample Request:

import requests

url = "https://uat-businessapi.spenn.com/api/Partner/business/accountbalance"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer eyJhbG...NrEQ41w"
}

# Make the GET request
response = requests.get(url, headers=headers)

# Check the response status
if response.status_code == 200:
    # Successful response
    print("Request was successful. Response JSON:")
    print(response.json())
else:
    # Handle the error
    print(f"Error: {response.status_code}\n{response.text}")

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class GetRequestExample {

    public static void main(String[] args) {
        try {
            // URL for the GET request
            String url = "https://uat-businessapi.spenn.com/api/Partner/business/accountbalance";

            // Create a URL object
            URL apiUrl = new URL(url);

            // Open a connection to the URL
            HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection();

            // Set the request method to GET
            connection.setRequestMethod("GET");

            // Set request headers
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setRequestProperty("Authorization", "Bearer eyJhbG...NrEQ41w");

            // Read the response
            BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            StringBuilder response = new StringBuilder();
            String line;

            while ((line = reader.readLine()) != null) {
                response.append(line);
            }

            reader.close();

            // Print the response
            System.out.println("Request was successful. Response JSON: " + response.toString());

            // Close the connection
            connection.disconnect();

        } catch (Exception e) {
            // Handle exceptions
            e.printStackTrace();
        }
    }
}

const url = "https://uat-businessapi.spenn.com/api/Partner/business/accountbalance";
const headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer eyJhbG...NrEQ41w"
};

// Make the GET request
fetch(url, {
    method: 'GET',
    headers: headers
})
    .then(response => {
        if (!response.ok) {
            throw new Error(`HTTP error! Status: ${response.status}`);
        }
        return response.json();
    })
    .then(data => {
        // Process the successful response
        console.log("Request was successful. Response JSON:", data);
    })
    .catch(error => {
        // Handle errors
        console.error('Error:', error);
    });

👍

Sample Response:

{
	"$id": "1",
	"amount": 10.00,
	"currency": "TZS" 
}