Skip to content

Get Balance

Returns D7 Account credit balance

GET
/messages/v1/balance

Authentication

AUTHORIZATIONS: Bearer Token

Request

1
2
3
curl --location --request GET 'https://api.d7networks.com/messages/v1/balance' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {{api_access_token}}'
var axios = require('axios');

var config = {
method: 'get',
url: 'https://api.d7networks.com/messages/v1/balance',
headers: { 
    'Accept': 'application/json', 
    'Authorization': 'Bearer {{api_access_token}}'
}
};

axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
import requests

url = "https://api.d7networks.com/messages/v1/balance"

payload={}
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {{api_access_token}}'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.d7networks.com/messages/v1/balance',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Authorization: Bearer {{api_access_token}}'
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
package main

import (
"fmt"
"net/http"
"io/ioutil"
)

func main() {

url := "https://api.d7networks.com/messages/v1/balance"
method := "GET"

client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)

if err != nil {
    fmt.Println(err)
    return
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer {{api_access_token}}")

res, err := client.Do(req)
if err != nil {
    fmt.Println(err)
    return
}
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
if err != nil {
    fmt.Println(err)
    return
}
fmt.Println(string(body))
}
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.d7networks.com/messages/v1/balance")
.method("GET", body)
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer {{api_access_token}}")
.build();
Response response = client.newCall(request).execute();
var headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {{api_access_token}}'
};
var request = http.Request('GET', Uri.parse('https://api.d7networks.com/messages/v1/balance'));

request.headers.addAll(headers);

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
1
2
3
4
5
6
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Accept", "application/json")
$headers.Add("Authorization", "Bearer {{api_access_token}}")

$response = Invoke-RestMethod 'https://api.d7networks.com/messages/v1/balance' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
require "uri"
require "net/http"

url = URI("https://api.d7networks.com/messages/v1/balance")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Accept"] = "application/json"
request["Authorization"] = "Bearer {{api_access_token}}"

response = https.request(request)
puts response.read_body

Response

200 - Success
{
"balance": 99.9999999
}
401 - Unauthorized
{ 
    "detail": { 
    "code": "ACCESS_TOKEN_SIGNATURE_VERIFICATION_FAILED",
    "message": "It looks like your requests were failed due to a missing or invalid 'Access Token'. Sign up at https://app.d7networks.com and create an authentication token in the developer section."
    } 
}