技能 编程开发 Linktree API快速上手指南

Linktree API快速上手指南

v20260423
linktree-hello-world
本示例提供了一个使用TypeScript的最小化工作示例,演示了Linktree API的核心功能。它涵盖了获取个人资料、创建链接、更新链接和列出所有链接的完整操作流程。适用于需要开发集成或测试Linktree API交互的开发者。
获取技能
127 次下载
概览

Linktree Hello World

Overview

Minimal working examples demonstrating core Linktree API functionality.

Instructions

Step 1: Get Profile

const profile = await client.profiles.get('myprofile');
console.log(`Bio: ${profile.bio}`);
console.log(`Links: ${profile.links.length}`);

Step 2: Create a Link

const link = await client.links.create({
  profile_id: profile.id,
  title: 'My Website',
  url: 'https://example.com',
  position: 0,  // Top of list
  thumbnail: 'https://example.com/icon.png'
});
console.log(`Created link: ${link.id}`);

Step 3: Update Link

await client.links.update(link.id, {
  title: 'Updated Title',
  archived: false
});

Step 4: List All Links

const links = await client.links.list({ profile_id: profile.id });
links.forEach(l => console.log(`${l.position}: ${l.title} → ${l.url}`));

Error Handling

Error Cause Solution
Auth error Invalid credentials Check LINKTREE_API_KEY
Not found Invalid endpoint Verify API URL
Rate limit Too many requests Implement backoff

Resources

Next Steps

See linktree-local-dev-loop.

信息
Category 编程开发
Name linktree-hello-world
版本 v20260423
大小 1.6KB
更新时间 2026-04-26
语言