Баланс аккаунта#
Получение баланса#
GET https://direct.i-dgtl.ru/api/v1/balance
Метод позволяет получить данные о состоянии баланса.
Headers#
Name |
Type |
Description |
|---|---|---|
Authorization* |
string |
|
В успешном ответе возвращается объект из пар «валюта»: «значение».
{
"RUB": 1200.00
}
Пример запроса#
GET https://direct.i-dgtl.ru/api/v1/balance
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
curl -X GET 'https://direct.i-dgtl.ru/api/v1/balance' \
-H 'Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
import requests
import json
url = "https://direct.i-dgtl.ru/api/v1/balance"
payload = {}
headers = {
'Content-Type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
const requestOptions = {
method: "GET",
headers: myHeaders,
redirect: "follow"
};
fetch("https://direct.i-dgtl.ru/api/v1/balance", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://direct.i-dgtl.ru/api/v1/balance")
.method("GET", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
<?php
$client = new Client();
$headers = [
'Content-Type' => 'application/json'
];
$request = new Request('GET', 'https://direct.i-dgtl.ru/api/v1/balance', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://direct.i-dgtl.ru/api/v1/balance"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}