Endpoint
GET https://altinapi.com/api/prices/GBPTRY
cURL
bash
curl -H "x-api-key: hapi_xxxx" \
https://altinapi.com/api/prices/GBPTRY
JSON Yanıt
JSON
{
"symbol": "GBPTRY",
"category": "DOVIZ",
"bid": 48.65, // alış fiyatı (TRY/GBP)
"ask": 48.73, // satış fiyatı (TRY/GBP)
"timestamp": 1741784400000 // Unix ms
}
Python
Python
import requests API_KEY = "hapi_xxxx" url = "https://altinapi.com/api/prices/GBPTRY" resp = requests.get(url, headers={"x-api-key": API_KEY}, timeout=5) data = resp.json() print(f"GBP/TRY alış: {data['bid']}") print(f"GBP/TRY satış: {data['ask']}")
JavaScript
JavaScript (fetch)
const resp = await fetch("https://altinapi.com/api/prices/GBPTRY", { headers: { "x-api-key": "hapi_xxxx" }, }); const data = await resp.json(); console.log(`GBP/TRY alış: ${data.bid}`); console.log(`GBP/TRY satış: ${data.ask}`);
WebSocket Aboneliği
Fiyat her değiştiğinde anlık almak için WebSocket kullanın:
JavaScript (socket.io-client)
import { io } from "socket.io-client"; const socket = io("https://altinapi.com", { auth: { apiKey: "hapi_xxxx" }, }); socket.on("connect", () => { socket.emit("subscribe", ["GBPTRY"]); }); socket.on("prices:update", ({ data }) => { const gbptry = data.find(p => p.symbol === "GBPTRY"); if (gbptry) console.log(gbptry.bid, gbptry.ask); });
Tüm Fiyatlarla Birlikte
Tek istekte tüm kategorileri çekmek için /api/prices kullanın:
GET https://altinapi.com/api/prices
Yanıtta category: "DOVIZ" olanları filtreleyin — GBPTRY bu grupta yer alır.