Кодовые фрагменты Node.js для API Numerology Dakidarts¶
Эти примеры демонстрируют, как вызывать конечные точки Core, Karmic, Cycles и Horoscope с использованием Node.js и ключа API Numerology.
Настройка¶
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);
Note
- Замените
"YOUR_API_KEY"на активный ключ из панели управления Numerology API. - Используйте GET для конечных точек с параметрами запроса и POST для конечных точек, требующих JSON-загрузку.
- Все конечные точки имеют последовательную структуру в Core, Karmic, Cycles и Horoscope данных.