开发者API文档

无缝集成我们的平台,释放您的业务潜力。

身份验证 #

所有 API 请求都需要通过提供您的私有 API Key 来进行身份验证。请在请求的 Authorization 标头中使用 Bearer 令牌。


curl "https://api.blueocean.com/v1/users" \
  -H "Authorization: Bearer YOUR_API_KEY"

{
  "Authorization": "Bearer YOUR_API_KEY"
}

接口端点 #

我们的 API 提供了一系列端点,用于与您的数据进行交互。以下是获取用户列表的示例。


curl "https://api.blueocean.com/v1/users?limit=10" \
  -H "Authorization: Bearer YOUR_API_KEY"

// Response
{
  "object": "list",
  "data": [
    {
      "id": "user_123",
      "name": "张三",
      "email": "[email protected]"
    },
    {
      "id": "user_456",
      "name": "李四",
      "email": "[email protected]"
    }
  ],
  "has_more": true,
  "url": "/v1/users?limit=10"
}

Webhooks #

通过配置 Webhooks,在您的帐户中发生特定事件时接收 HTTP 回调。例如,当新用户注册时,您将收到通知。


// Webhook Payload for `user.created`
{
  "event": "user.created",
  "data": {
    "object": {
      "id": "user_789",
      "name": "王五",
      "email": "[email protected]",
      "created_at": 1678886400
    }
  }
}

SDK 示例 #

我们提供多种语言的 SDK 以简化集成。以下是使用我们的 Node.js SDK 获取用户列表的示例。


const blueocean = require('blueocean-sdk')('YOUR_API_KEY');
async function listUsers() {
  try {
    const users = await blueocean.users.list({ limit: 10 });
    console.log(users);
  } catch (error) {
    console.error(error);
  }
}
listUsers();