Rahu Kaal API - Angular Integration

Calculate daily Rahu Kaal inauspicious period

Overview

Calculate daily Rahu Kaal inauspicious period

POST /v2/astrology/rahu-kaal
Pricing: $0.002 per request | Framework: Angular | Auth: API Key required

Quick Start

1. Installation

# HttpClient is built into Angular

2. Environment Setup

# .env or .env.local
VEDIKA_API_KEY=your_api_key_here
Security: Never commit API keys to version control. Always use environment variables.

Complete Implementation

// rahu-kaal.service.ts
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { environment } from '../environments/environment';

interface RahuKaalResponse {
  success: boolean;
  data: any;
  timestamp: string;
  cost: number;
}

@Injectable({
  providedIn: 'root'
})
export class RahuKaalService {
  private baseUrl = 'https://vedika-api-854222120654.us-central1.run.app';

  constructor(private http: HttpClient) {}

  getRahuKaal(params: any): Observable {
    const headers = new HttpHeaders({
      'Content-Type': 'application/json',
      'x-api-key': environment.vedikaApiKey
    });

    return this.http.post(
      `${this.baseUrl}/v2/astrology/rahu-kaal`,
      params,
      { headers }
    );
  }
}

// rahu-kaal.component.ts
import { Component } from '@angular/core';
import { RahuKaalService } from './rahu-kaal.service';

@Component({
  selector: 'app-rahu-kaal',
  templateUrl: './rahu-kaal.component.html',
  styleUrls: ['./rahu-kaal.component.css']
})
export class RahuKaalComponent {
  data: any = null;
  loading = false;
  error: string | null = null;

  constructor(private rahu-kaalService: RahuKaalService) {}

  fetchRahuKaal(params: any): void {
    this.loading = true;
    this.error = null;

    this.rahu-kaalService.getRahuKaal(params).subscribe({
      next: (response) => {
        this.data = response.data;
        this.loading = false;
      },
      error: (err) => {
        this.error = err.error?.error || 'An error occurred';
        this.loading = false;
      }
    });
  }
}

Request Parameters

Parameter Type Required Description
date varies Yes See API documentation
latitude varies Yes See API documentation
longitude varies Yes See API documentation
timezone varies Yes See API documentation

Error Handling

Status Code Error Solution
400 Bad Request Check request parameters and format
401 Unauthorized Verify API key is correct
402 Payment Required Insufficient balance - recharge at console.vedika.io
429 Rate Limit Exceeded Implement exponential backoff or upgrade plan
500 Server Error Retry after a few seconds

Best Practices

Response Format

{
  "success": true,
  "data": {
    // Endpoint-specific response data
  },
  "timestamp": "2026-01-07T10:30:00Z",
  "cost": 0.002
}

Related Endpoints

Birth Chart Kundli Match Panchang Dasha Periods Dosha Analysis

Other Frameworks

React Next.js Vue.js Node.js Python/Flask Django Ruby on Rails

Support

Need help integrating this endpoint?