ਸਮੱਗਰੀ 'ਤੇ ਜਾਓ
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), ਦਸ਼ਮਲਵ ਡਿਗਰੀਆਂ ਵਿੱਚ ਅਕਸ਼ਾਂਸ਼ ਅਤੇ ਰੇਖਾਂਸ਼, ਅਤੇ IANA ਟਾਈਮਜ਼ੋਨ ਦਿਓ।

data.date, sunrise, sunset, tithi, nakshatra, yoga, karanas ਅਤੇ rahuKalam ਦਿਖਾਓ।

4 ਕੋਟਾ

ਇੱਕ ਸਫਲ ਕਾਲ ਇੱਕ ਸਮੱਗਰੀ ਬੇਨਤੀ ਵਰਤਦੀ ਹੈ। ਸੈਂਡਬਾਕਸ ਅਤੇ ਲਾਈਵ ਬੇਨਤੀਆਂ ਦੀ ਵਰਤੋਂ ਵੱਖਰੀ ਗਿਣੀ ਜਾਂਦੀ ਹੈ। ਅਸਫਲ ਗਣਨਾਵਾਂ ਵਾਪਸ ਕਰ ਦਿੱਤੀਆਂ ਜਾਂਦੀਆਂ ਹਨ।

ਬੇਨਤੀਆਂ ਬੇਸ URL MANTRILO_API_URL ਤੋਂ ਪੜ੍ਹਦੀਆਂ ਹਨ। ਸਰਵਰ ਉਦਾਹਰਨ ਵਿੱਚ ਇਸ ਦੇ ਨਾ ਹੋਣ 'ਤੇ https://api.mantrilo.com ਵਰਤਿਆ ਜਾਂਦਾ ਹੈ।