整合指南
透過逐步說明和程式碼範例,掌握將 MyAds 整合到您的數位生態系統中。
在開發人員儀表板中定義您的應用程式名稱、網域和重定向 URI,以接收您唯一的用戶端 ID 和金鑰。
資訊: 在提交應用程式以供審核之前,請準備好您的公共網域、回調 URL 和請求的範圍。
實施授權程式碼流程,以允許成員安全地授予對其資料和身分的存取權限。
Redirect the user to the authorization endpoint. The user will be prompted to grant the requested permissions.
GET https://testxxc.lockr.sbs/oauth/authorize?
client_id=YOUR_CLIENT_ID&
redirect_uri=https://yourapp.com/callback&
response_type=code&
scope=user.identity.read%20user.profile.read&
state=RANDOM_CSRF_STATE
Once authorized, the user is redirected back to your redirect_uri with a code query parameter. Exchange this code via a secure server-to-server POST request:
POST https://testxxc.lockr.sbs/oauth/token
Content-Type: application/json
{
"grant_type": "authorization_code",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"redirect_uri": "https://yourapp.com/callback",
"code": "AUTHORIZATION_CODE"
}
{
"access_token": "def50200a87...",
"refresh_token": "def50200b92...",
"expires_in": 3600,
"token_type": "Bearer"
}
Provide the access token in the Authorization: Bearer {access_token} HTTP header on all API requests:
GET https://testxxc.lockr.sbs/api/developer/v1/me HTTP/1.1
Host: testxxc.lockr.sbs
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
使用我們全面的程式碼範例連接您的後端或將互動式小工具直接嵌入到您的網站中。
<?php
$clientId = 'YOUR_CLIENT_ID';
$clientSecret = 'YOUR_CLIENT_SECRET';
$code = $_GET['code']; // Code received from authorization redirect
// 1. Exchange code for access token
$ch = curl_init('https://testxxc.lockr.sbs/oauth/token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'grant_type' => 'authorization_code',
'client_id' => $clientId,
'client_secret' => $clientSecret,
'redirect_uri' => 'https://yourapp.com/callback',
'code' => $code
]);
$response = json_decode(curl_exec($ch), true);
$accessToken = $response['access_token'];
// 2. Fetch authenticated member identity
$ch = curl_init('https://testxxc.lockr.sbs/api/developer/v1/me');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $accessToken,
'Accept: application/json'
]);
$user = json_decode(curl_exec($ch), true);
print_r($user);
?>
const axios = require('axios');
async function authenticateAndFetchUser(authCode) {
// 1. Exchange authorization code for token
const tokenResponse = await axios.post('https://testxxc.lockr.sbs/oauth/token', {
grant_type: 'authorization_code',
client_id: 'YOUR_CLIENT_ID',
client_secret: 'YOUR_CLIENT_SECRET',
redirect_uri: 'https://yourapp.com/callback',
code: authCode
});
const accessToken = tokenResponse.data.access_token;
// 2. Call Developer API v1 endpoint
const userResponse = await axios.get('https://testxxc.lockr.sbs/api/developer/v1/me', {
headers: {
'Authorization': `Bearer ${accessToken}`,
'Accept': 'application/json'
}
});
return userResponse.data.data;
}
import requests
def get_user_profile(auth_code):
# 1. Exchange code for access token
token_url = 'https://testxxc.lockr.sbs/oauth/token'
payload = {
'grant_type': 'authorization_code',
'client_id': 'YOUR_CLIENT_ID',
'client_secret': 'YOUR_CLIENT_SECRET',
'redirect_uri': 'https://yourapp.com/callback',
'code': auth_code
}
token_res = requests.post(token_url, data=payload)
access_token = token_res.json().get('access_token')
# 2. Call Developer API v1
api_url = 'https://testxxc.lockr.sbs/api/developer/v1/me'
headers = {
'Authorization': f'Bearer {access_token}',
'Accept': 'application/json'
}
user_res = requests.get(api_url, headers=headers)
return user_res.json()
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using System.Collections.Generic;
public async Task<string> GetUserProfile(string authCode) {
using var client = new HttpClient();
// 1. Exchange code for token
var parameters = new Dictionary<string, string> {
{ "grant_type", "authorization_code" },
{ "client_id", "YOUR_CLIENT_ID" },
{ "client_secret", "YOUR_CLIENT_SECRET" },
{ "redirect_uri", "https://yourapp.com/callback" },
{ "code", authCode }
};
var content = new FormUrlEncodedContent(parameters);
var tokenResponse = await client.PostAsync("https://testxxc.lockr.sbs/oauth/token", content);
var tokenJson = await tokenResponse.Content.ReadAsStringAsync();
// Parse accessToken from tokenJson ...
string accessToken = "EXTRACTED_ACCESS_TOKEN";
// 2. Call Developer API v1
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var userResponse = await client.GetAsync("https://testxxc.lockr.sbs/api/developer/v1/me");
return await userResponse.Content.ReadAsStringAsync();
}
# 1. Exchange authorization code for token
curl -X POST https://testxxc.lockr.sbs/oauth/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=authorization_code" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET" \
-d "code=AUTHORIZATION_CODE" \
-d "redirect_uri=https://yourapp.com/callback"
# 2. Call Developer API v1 with Bearer token
curl -X GET https://testxxc.lockr.sbs/api/developer/v1/me \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Accept: application/json"
Complete catalog of available REST API v1 endpoints with request parameters and required scopes.
All requests require the Authorization: Bearer {token} header and are rate-limited to 30 requests per minute.
閱讀會員帳戶識別碼和基本公共身分欄位。
閱讀公共個人資料詳細資訊和核心成員元資料。
Access the primary verified email address of the member.
閱讀會員個人資料附帶的公開社交連結。
讀取可見成員的追蹤者和關注關係。
Follow or unfollow other members on behalf of the user.
{"target_user_id": 123, "action": "follow|unfollow|toggle"}
Read public posts and status updates authored by the user.
Create, update, and publish posts on behalf of the user.
{"content": "Post text", "privacy": "public|followers|private"}
Add or toggle likes and reactions to content on behalf of the user.
{"status_id": 123}
Read private direct message conversations belonging to the user.
Send private direct messages on behalf of the user.
{"receiver_id": 123, "content": "Message body"}
Read account notifications, alerts, and unread counters.
Read user points balance, rewards, and wallet details.
Read member badges, unlocked achievements, and quest status.
Browse short video clips feed and saved clips in user account.
Read forum categories, topics, discussions, and replies.
Browse marketplace products, offerings, and store knowledgebase.
Read user purchase orders history and submitted offers.
Read ad impression counts, clicks, and campaign performance statistics.
透過開發者 API 讀取授權所有者資料。
閱讀授權所有者內容來源和發布的更新。
代表授權所有者追蹤或取消追蹤成員。
代表授權所有者發送私人訊息。
{"content": "Message text"}
Granular permissions requested by third-party applications during the OAuth authorization flow.
| Category | Scope Identifier | Description | Type |
|---|---|---|---|
| Identity |
user.identity.read
|
閱讀會員帳戶識別碼和基本公共身分欄位。 | Standard Scope |
| Identity |
user.profile.read
|
閱讀公共個人資料詳細資訊和核心成員元資料。 | Standard Scope |
| Identity |
user.email.read
|
Access the primary verified email address of the member. | Sensitive Scope |
| Identity |
user.social_links.read
|
閱讀會員個人資料附帶的公開社交連結。 | Standard Scope |
| Identity |
user.follows.read
|
讀取可見成員的追蹤者和關注關係。 | Standard Scope |
| Identity |
user.follows.write
|
Follow or unfollow other members on behalf of the user. | Sensitive Scope |
| Content |
user.content.read
|
Read public posts and status updates authored by the user. | Standard Scope |
| Content |
user.content.write
|
Create, update, and publish posts on behalf of the user. | Sensitive Scope |
| Content |
user.reactions.write
|
Add or toggle likes and reactions to content on behalf of the user. | Standard Scope |
| Content |
user.comments.write
|
Publish comments and replies on posts on behalf of the user. | Sensitive Scope |
| Messaging |
user.messages.read
|
Read private direct message conversations belonging to the user. | Sensitive Scope |
| Messaging |
user.messages.write
|
Send private direct messages on behalf of the user. | Sensitive Scope |
| Messaging |
user.notifications.read
|
Read account notifications, alerts, and unread counters. | Standard Scope |
| Economy |
user.wallet.read
|
Read user points balance, rewards, and wallet details. | Sensitive Scope |
| Economy |
user.badges.read
|
Read member badges, unlocked achievements, and quest status. | Standard Scope |
| Community |
user.clips.read
|
Browse short video clips feed and saved clips in user account. | Standard Scope |
| Community |
user.clips.write
|
Save and unsave short video clips on behalf of the user. | Standard Scope |
| Community |
user.forums.read
|
Read forum categories, topics, discussions, and replies. | Standard Scope |
| Community |
user.forums.write
|
Create new topics and post replies in forums on behalf of the user. | Sensitive Scope |
| Commerce |
user.store.read
|
Browse marketplace products, offerings, and store knowledgebase. | Standard Scope |
| Commerce |
user.orders.read
|
Read user purchase orders history and submitted offers. | Sensitive Scope |
| Commerce |
user.ads.read
|
Read ad impression counts, clicks, and campaign performance statistics. | Standard Scope |
| Owner |
owner.profile.read
|
透過開發者 API 讀取授權所有者資料。 | Standard Scope |
| Owner |
owner.content.read
|
閱讀授權所有者內容來源和發布的更新。 | Standard Scope |
| Owner |
owner.follow.write
|
代表授權所有者追蹤或取消追蹤成員。 | Sensitive Scope |
| Owner |
owner.messages.read
|
閱讀屬於授權所有者的私人訊息對話。 | Sensitive Scope |
| Owner |
owner.messages.write
|
代表授權所有者發送私人訊息。 | Sensitive Scope |
在您的網站上嵌入我們的小部件以顯示您的 MyAds 個人資料、內容或追蹤按鈕。
Embed an interactive button allowing visitors to follow your profile on MYADS with a single click.
<div id="myads-widget-follow-YOUR_APP_ID"></div>
<script src="https://testxxc.lockr.sbs/embed/developer/YOUR_APP_ID/follow.js"></script>
Display your verified badge, avatar, bio, follower count, and stats on your website.
<div id="myads-widget-profile-YOUR_APP_ID"></div>
<script src="https://testxxc.lockr.sbs/embed/developer/YOUR_APP_ID/profile.js"></script>
Showcase your latest public posts and status updates dynamically inside your web application.
<div id="myads-widget-content-YOUR_APP_ID"></div>
<script src="https://testxxc.lockr.sbs/embed/developer/YOUR_APP_ID/content.js"></script>
使用共用 API 為帖子編輯器預先填入文字和連結。
https://testxxc.lockr.sbs/share?text=Check+out+this+article!+https://example.com
API requests are limited to 30 requests per minute per client IP. Bearer tokens must be kept confidential.
429 Too Many Requests.
success, message, and data fields:
{
"success": true,
"message": "Operation completed successfully.",
"data": { ... }
}
Accept-Language: ar or Accept-Language: en in request headers to receive localized responses and validation messages.
確認
您確定要刪除嗎?