콘텐츠로 이동

Node.js 코드를 사용하여 Dakidarts Numerology API 호출하기

이 예제는 Node.js 및 직접적인 Numerology API 키를 사용하여 Core, Karmic, Cycles, 그리고 Horoscope 엔드포인트를 호출하는 방법을 보여줍니다.


설정

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: 태도 번호

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: 도전 번호

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: 카르믹 부채

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: 카르믹 교훈

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: 라이프 패스 번호

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: 성격 번호

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: 운명 번호

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: 마음의 소망 번호

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: 개인 연도

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: 조상 분석

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: 표현의 평면

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: 오늘 운세

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: 오늘 직업 운세

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: 오늘 건강 운세

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: 행성별 일운

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: 에센스 사이클

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: 천문학적 이동

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 데이터의 모든 엔드포인트는 일관된 구조를 따릅니다.