मुख्य मजकुराकडे जा
API key मिळवा

मार्गदर्शिका · ज्योतिष

Daily Panchang

स्थानिक दैनिक पंचांग कॅलेंडर तयार करा.

ही रिक्वेस्ट सँडबॉक्समध्ये वापरून पाहा

1 चालणारी रिक्वेस्ट पाठवा

POST /v1/astrology/calculate
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"}'
पडताळलेल्या नवी दिल्ली रिस्पॉन्सचा उतारा200 OK
{
  "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
// 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), दशांश अंशांमध्ये latitude आणि longitude, आणि IANA टाइम झोन द्या.

data.date, sunrise, sunset, tithi, nakshatra, yoga, karanas आणि rahuKalam दाखवा.

4 कोटा

एका यशस्वी कॉलसाठी एक कंटेंट रिक्वेस्ट वापरली जाते. सँडबॉक्स आणि लाइव्ह रिक्वेस्टचा वापर वेगवेगळा मोजला जातो. अयशस्वी गणनांसाठी वापरलेली रिक्वेस्ट परत जमा होते.

रिक्वेस्ट बेस URL MANTRILO_API_URL मधून घेतात. ते नसल्यास सर्व्हर उदाहरण https://api.mantrilo.com वापरते.