Introduction
Welcome to the Bitbarg API!
This is the official Bitbarg API documentation, and will be continue updating.
The main content of each API document has three parts, the left hand side is the contents, the middle part is the document body, and the right hand side is the request and response sameple.
Authentication
Currently, none of the endpoints provided require authentication.
Access URL
REST API BaseURL: https://api.bitbarg.com
Currencies
Get Currencies Price
curl -X GET https://api.bitbarg.com/api/v1/docs/prices \
-H 'Accept: application/json' \
-H 'Content-Type: application/json'
<?php
$host = "https://api.bitbarg.com"
$prefix = "/api/v1/docs"
$url = '/prices'
$queryParam = '' // example: 'coin=BTC&pageSize=10'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $host . $prefix . $url . "?" . $queryParam,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Accept: application/json'
]
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
# coding: utf-8
import requests
host = "https://api.bitbarg.com"
prefix = "/api/v1/docs"
url = '/prices'
query_param = '' # example: 'coin=BTC&pageSize=10'
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
r = requests.request('GET', host + prefix + url + "?" + query_param, headers=headers)
print(r.json())
const host = "https://api.bitbarg.com";
const prefix = "/api/v1/docs";
const url = "/prices";
const queryParam = ""; // example: 'coin=BTC&pageSize=10'
const headers = new Headers();
headers.append("Accept", "application/json");
headers.append("Content-Type", "application/json");
const requestOptions = {
method: "GET",
headers: headers,
};
fetch(`${host}${prefix}${url}?${queryParam}`, requestOptions)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.error(error));
The above command returns JSON structured like this:
{
"apiVersion": "0.1",
"success": true,
"result": {
"items": [
{
"slug": "BTC",
"price": 3354952185,
"update_at": "1403-04-19 14:20:24"
},
{
"slug": "ETH",
"price": 180344385,
"update_at": "1403-04-19 14:20:01"
},
{
"slug": "USDT",
"price": 58500,
"update_at": "1403-04-19 14:21:31"
}
],
"meta": {
"paginateHelper": {
"currentPage": 1,
"currentCount": 3,
"requestId": "ZVjsp",
"total": 2088,
"pageSize": 3,
"lastPage": 696
}
}
},
"error": null,
"paginate": true,
"message": "OK"
}
This endpoint retrieves all currencies price.
HTTP Request
GET /api/v1/docs/prices
URL Parameters
Parameter | Type | In | Description | Required |
---|---|---|---|---|
pageSize | integer | query | Items per page | False (Default: 50 ) |
page | integer | query | Page number | False (Default: 1 ) |
base | enum | query | Unit of price (should be toman or usdt ) |
False (Default: toman ) |
coin | string | query | Slug of specific coin | False |
Errors
The Bitbarg API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key is wrong. |
403 | Forbidden -- The item requested is hidden for administrators only. |
404 | Not Found -- The specified item could not be found. |
405 | Method Not Allowed -- You tried to access an item with an invalid method. |
406 | Not Acceptable -- You requested a format that isn't json. |
410 | Gone -- The item requested has been removed from our servers. |
429 | Too Many Requests -- You're requesting too many requests! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |