માર્ગદર્શિકાઓ · જ્યોતિષ
Daily Panchang
સ્થાનિક દૈનિક પંચાંગ કૅલેન્ડર બનાવો.
આ રિક્વેસ્ટ સેન્ડબોક્સમાં અજમાવો1 ચાલતી રિક્વેસ્ટ મોકલો
curl -X POST "$MANTRILO_API_URL/v1/astrology/calculate" \
-H "Authorization: Bearer $MANTRILO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"date":"2026-11-15","latitude":28.6139,"longitude":77.209,"timezone":"Asia/Kolkata","operation":"daily-panchang"}'{
"data": {
"operation": "daily-panchang",
"engineVersion": "mantrilo-vedic-1",
"date": "2026-11-15",
"timezone": "Asia/Kolkata",
"basis": "local_sunrise",
"sunrise": "06:43:19",
"sunset": "17:27:50",
"tithi": {
"number": 6,
"name": "Shashti",
"paksha": "Shukla",
"endsAt": "2026-11-16T02:01:40.095280+05:30"
},
"nakshatra": {
"number": 21,
"name": "Uttara Ashadha",
"pada": 2,
"lord": "Sun",
"endsAt": "2026-11-15T23:29:06.472952+05:30"
},
"yoga": {
"number": 10,
"name": "Ganda",
"endsAt": "2026-11-16T07:16:28.084160+05:30"
},
"karanas": [
{
"number": 3,
"name": "Kolav",
"endsAt": "2026-11-15T12:44:29.104828+05:30"
},
{
"number": 4,
"name": "Tetil",
"endsAt": "2026-11-16T02:01:40.095280+05:30"
}
],
"rahuKalam": {
"start": "16:07",
"end": "17:27"
}
},
"calculated": true
}2 તેને તમારા સર્વર પરથી કૉલ કરો
key તમારા બૅકએન્ડમાં રાખો અને તમારી ઍપને ફક્ત કન્ટેન્ટ પાછું આપો. આ Node.js સર્વર એક રૂટ આપે છે જેને તમારી ઍપ કૉલ કરી શકે.
// server.mjs · Node.js 22+
import { createServer } from 'node:http';
const apiKey = process.env.MANTRILO_API_KEY;
if (!apiKey) throw new Error('Set MANTRILO_API_KEY on your server.');
const base = process.env.MANTRILO_API_URL ?? "https://api.mantrilo.com";
async function mantrilo(path, input) {
const response = await fetch(base + path, {
method: input ? 'POST' : 'GET',
headers: {
Authorization: 'Bearer ' + apiKey,
...(input ? { 'Content-Type': 'application/json' } : {}),
},
...(input ? { body: JSON.stringify(input) } : {}),
signal: AbortSignal.timeout(20000),
redirect: 'error',
});
const result = await response.json();
if (!response.ok) throw Object.assign(new Error('Mantrilo request failed'), {
status: response.status, requestId: result.requestId,
});
return result;
}
async function load(incoming, input) {
return mantrilo("/v1/astrology/calculate", { ...input, operation: "daily-panchang" });
}
createServer(async (req, res) => {
const incoming = new URL(req.url, 'http://localhost');
res.setHeader('Content-Type', 'application/json');
if (req.method !== 'POST' || incoming.pathname !== '/api/mantrilo-guide') {
res.writeHead(404).end(JSON.stringify({ error: 'Not found' }));
return;
}
try {
let text = '';
for await (const chunk of req) {
text += chunk;
if (Buffer.byteLength(text) > 16384) {
res.writeHead(413).end(JSON.stringify({ error: 'Input is too large' }));
return;
}
}
let input;
try { input = JSON.parse(text); } catch { input = null; }
if (!input || typeof input !== 'object' || Array.isArray(input)) {
res.writeHead(400).end(JSON.stringify({ error: 'Send a JSON object' }));
return;
}
const result = await load(incoming, input);
res.end(JSON.stringify(result));
} catch (error) {
res.writeHead(error.status ?? 502).end(JSON.stringify({
error: 'Could not load this content',
requestId: error.requestId,
}));
}
}).listen(3000, '127.0.0.1');const { sunrise, sunset, tithi } = data;3 ઇનપુટ અને પેજિનેશન
સ્થાનિક તારીખ (YYYY-MM-DD), દશાંશ અંશમાં અક્ષાંશ અને રેખાંશ, અને IANA ટાઇમ ઝોન આપો.
data.date, sunrise, sunset, tithi, nakshatra, yoga, karanas અને rahuKalam બતાવો.
4 ક્વોટા
એક સફળ કૉલ એક કન્ટેન્ટ રિક્વેસ્ટ વાપરે છે. સેન્ડબોક્સ અને લાઇવ રિક્વેસ્ટના વપરાશના કુલ આંકડા અલગ હોય છે. નિષ્ફળ ગણતરીઓની રિક્વેસ્ટ પાછી મળે છે.
રિક્વેસ્ટ base URL MANTRILO_API_URL માંથી વાંચે છે. સર્વરનું ઉદાહરણ ન મળે તો https://api.mantrilo.com વાપરે છે.
