Подправить запрос
4 USDПривет Андрiй,
можешь пожалуйста помочь подправить мой запрос к API (нужно сделать с помощью javascript)?
В заголовок (header) нужно вставить "X-API-Key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" и чесно сказать, я не знаю как это правильно сделать. Без него я не могу получить данные. На данный момент получаю две ошибки.
Возможно я написал все неправильно
=======================
1) net::ERR_ABORTED 401 (Unauthorized)
2) SyntaxError: Unexpected end of input
at fetchAsyncTodos
=======================
Скрипт
const USERID = '1006798';
let url = 'https://api.xxxxx.com/profile/v1/' + USERID
async function fetchAsyncTodos(){
console.log('Fetch todo started...')
try {
const response = await fetch(url, {
method: "GET",
headers: {
"Content-type": "application/json;charset=UTF-8",
"X-API-Key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
mode: "no-cors"
})
const data = await response.json()
console.log('Data:', data)
} catch (e) {
console.error(e)
} finally {
}
}
fetchAsyncTodos()
Из справочника API
Get customer profile
curl "https://api.xxxxxx.com/v1/profile/<customerId>"
-H "Authorization: YOUR-API-KEY-HERE"
Make sure to replace
<customerId>with the id of a customerThe above command returns JSON structured like this:
{
"avatarUrl": "https://cdn.xxxxxxx.com/v1/avatar/render/f0H2_985mg25f02",
"avatarCode": "5FG3kI30_f3wgshjss43h4",
"unlockedAchievementCount": 19,
"unlockedAchievementsPerTier": {
"1": 14,
"2": 4,
"3": 1
},
"customerLevel": 4,
"xp": 1550,
"xpToCurrentLevel": 1500,
"xpToNextLevel": 2000
}Current freelance projects in the category Javascript and Typescript
Fix the CSS/DOM layout of cards in the Chrome extension for localizing D&D BeyondThere is a Chrome extension Manifest V3 that localizes the D&D Beyond website into Ukrainian. The project is written in TypeScript + WXT. The extension works through a content script: it finds English text on D&D Beyond pages and replaces it with the Ukrainian translation. The… HTML & CSS, Javascript and Typescript ∙ 19 hours 12 minutes back ∙ 36 proposals |
Development of the AM Mobility platform (car service, parking, insurance, car rental)
5768 USD
We are looking for a team or an experienced Full Stack developer to create the MVP of the AM Mobility platform. AM Mobility is a unified digital ecosystem for motorists, combining in one application and web platform: parking; car service; tire fitting; car wash; car rental;… Javascript and Typescript, Web Programming ∙ 1 day 4 hours back ∙ 95 proposals |
Gsap animations
22 USD
Good day. Corrections need to be made in the current project. A specialist is needed who works well with gsap/lenis. Animation of cards needs to be done. Detailed specifications here:… Javascript and Typescript, Web Programming ∙ 1 day 9 hours back ∙ 18 proposals |
Commercial on-premise video communication platform "ViM"It is required to develop an on-premise video conferencing system with a basic calculation for 100 simultaneous connections (10 isolated rooms of 10 people each). The platform should have a built-in architecture for future horizontal scaling up to 1000 users by adding new media… Javascript and Typescript, Web Programming ∙ 2 days 5 hours back ∙ 30 proposals |
I am looking for a mentor with Claude Code to launch a web project from scratch.Brief about the task: I am a beginner with no programming experience. I have a ready specification for website development (42 pages, Next.js, PostgreSQL). I want to implement it myself using Claude Code - I need a specialist who will set up the environment and teach me how to… Javascript and Typescript, Tuition ∙ 3 days 8 hours back ∙ 18 proposals |