REST API リファレンス
基本設定
ベース URL: {site_url}/wp-json/wu/v2/
認証: API Key とシークレット(HTTP Basic Auth または URL パラメータ)
認証
API を有効化
// Enable API in Ultimate Multisite settings or programmatically
wu_save_setting('enable_api', true);
API 認証情報を取得
$api_key = wu_get_setting('api_key');
$api_secret = wu_get_setting('api_secret');
認証方法
HTTP Basic Auth(推奨):
curl -u "api_key:api_secret" https://yoursite.com/wp-json/wu/v2/customers
URL パラメータ:
curl "https://yoursite.com/wp-json/wu/v2/customers?api_key=your_key&api_secret=your_secret"
コアエンドポイント
1. 顧客 API
ベースルート: /customers
すべての顧客を取得
GET /wu/v2/customers
単一の顧客を取得
GET /wu/v2/customers/{id}
顧客を作成
POST /wu/v2/customers
Content-Type: application/json
{
"user_id": 123,
"email_verification": "verified",
"type": "customer",
"has_trialed": false,
"vip": false
}
顧客を更新
PUT /wu/v2/customers/{id}
Content-Type: application/json
{
"vip": true,
"extra_information": "VIP customer notes"
}
顧客を削除
DELETE /wu/v2/customers/{id}
2. サイト API
ベースルート: /sites
サイトを作成
POST /wu/v2/sites
Content-Type: application/json
{
"customer_id": 5,
"membership_id": 10,
"domain": "example.com",
"path": "/",
"title": "My New Site",
"template_id": 1,
"type": "customer_owned"
}
3. メンバーシップ API
ベースルート: /memberships
メンバーシップを作成
POST /wu/v2/memberships
Content-Type: application/json
{
"customer_id": 5,
"plan_id": 3,
"status": "active",
"gateway": "stripe",
"gateway_subscription_id": "sub_1234567890",
"auto_renew": true
}
4. 商品 API
ベースルート: /products
すべての商品を取得
GET /wu/v2/products