コンテンツにスキップ

Node.js を使用した Dakidarts Numerology API のコード例

これらの例は、Core, Karmic, Cycles, および Horoscope エンドポイントを呼び出す方法を示しており、Node.js と直接的な Numerology API キーを使用します。


セットアップ

const axios = require('axios');

const headers = {
    'X-API-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
};

async function getRequest(url, params = {}) {
    const response = await axios.get(url, { params, headers });
    return response.data;
}

async function postRequest(url, payload = {}) {
    const response = await axios.post(url, payload, { headers });
    return response.data;
}

例 1: Attitude Number (態度番号)

const url = "https://api.numerologyapi.com/api/v1/attitude_number";
const params = { birth_day: "14", birth_month: "3" };

getRequest(url, params).then(console.log).catch(console.error);

例 2: Challenge Number (課題番号)

const url = "https://api.numerologyapi.com/api/v1/challenge_number/post";
const payload = { birth_year: 1990, birth_month: 5, birth_day: 15 };

postRequest(url, payload).then(console.log).catch(console.error);

例 3: Karmic Debt (カルミック・デット)

const url = "https://api.numerologyapi.com/api/v1/karmic_debt";
const params = { birth_year: "2023", birth_month: "6", birth_day: "28" };

getRequest(url, params).then(console.log).catch(console.error);

例 4: Karmic Lessons (カルミック・レッスン)

const url = "https://api.numerologyapi.com/api/v1/karmic_lessons";
const params = { full_name: "John Doe Smith" };

getRequest(url, params).then(console.log).catch(console.error);

例 5: Life Path Number (ライフ・パス・ナンバー)

const url = "https://api.numerologyapi.com/api/v1/life_path";
const params = { birth_year: "1990", birth_month: "5", birth_day: "12" };

getRequest(url, params).then(console.log).catch(console.error);

例 6: Personality Number (パーソナリティ・ナンバー)

const url = "https://api.numerologyapi.com/api/v1/personality_number/post";
const payload = { first_name: "John", middle_name: "Robert", last_name: "Doe" };

postRequest(url, payload).then(console.log).catch(console.error);

例 7: Destiny Number (デスティニー・ナンバー)

const url = "https://api.numerologyapi.com/api/v1/destiny_number";
const params = { first_name: "John", middle_name: "Doe", last_name: "Smith" };

getRequest(url, params).then(console.log).catch(console.error);

例 8: Heart Desire Number (ハート・デザイア・ナンバー)

const url = "https://api.numerologyapi.com/api/v1/heart_desire";
const params = { first_name: "John", middle_name: "Robert", last_name: "Doe" };

getRequest(url, params).then(console.log).catch(console.error);

例 9: Personal Year (パーソナル・イヤー)

const url = "https://api.numerologyapi.com/api/v1/personal_year";
const params = { prediction_year: "2023", birth_month: "12", birth_day: "3" };

getRequest(url, params).then(console.log).catch(console.error);

例 10: Ancestor Reading (祖先リーディング)

const url = "https://api.numerologyapi.com/api/v1/ancestor-reading";
const params = { family_name: "Etuge" };

getRequest(url, params).then(console.log).catch(console.error);

例 11: Planes Of Expression (表現の計画)

const url = "https://api.numerologyapi.com/api/v1/planes-of-expression";
const payload = { fullname: "Jesus Christ" };

postRequest(url, payload).then(console.log).catch(console.error);

例 12: Today Horoscope (今日のホロスコープ)

const url = "https://api.numerologyapi.com/api/v1/horoscope/today";
const params = { dob: "2002-02-22" };

getRequest(url, params).then(console.log).catch(console.error);

例 13: Today Career Horoscope (今日のキャリア・ホロスコープ)

const url = "https://api.numerologyapi.com/api/v1/horoscope/career/today";
const payload = { dob: "1995-08-20" };

postRequest(url, payload).then(console.log).catch(console.error);

例 14: Today Health Horoscope (今日のヘルス・ホロスコープ)

const url = "https://api.numerologyapi.com/api/v1/horoscope/health/today";
const params = { dob: "1995-08-20" };

getRequest(url, params).then(console.log).catch(console.error);

例 15: Planetary Daily Horoscope (惑星のデイリー・ホロスコープ)

const url = "https://api.numerologyapi.com/api/v1/horoscope/planetary/daily";
const params = { dob: "1990-01-01", day: "today" };

getRequest(url, params).then(console.log).catch(console.error);

例 16: Essence Cycle (エッセンス・サイクル)

const url = "https://api.numerologyapi.com/api/v1/essence-cycle";
const params = { full_name: "Alexander Graham Bell", dob: "1847-03-03", start_year: "1847" };

getRequest(url, params).then(console.log).catch(console.error);

例 17: Transits (トランジット)

const url = "https://api.numerologyapi.com/api/v1/transits";
const payload = { full_name: "Alexander Graham Bell", dob: "1847-03-03" };

postRequest(url, payload).then(console.log).catch(console.error);

!!! 注意 "YOUR_API_KEY" を、Numerology API ダッシュボードから取得した有効なキーで置き換えてください。 クエリパラメータを持つエンドポイントには GET、JSONペイロードが必要なエンドポイントには POST を使用してください。* すべてのエンドポイントは、Core、Karmic、Cycles、およびHoroscopeのデータにおいて一貫した構造に従っています。