REST API حوالو
بنيادي ترتيب
بنيادي URL: {site_url}/wp-json/wu/v2/
تصديق: API Key ۽ Secret (HTTP Basic Auth يا URL Parameters)
تصديق
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 Parameters:
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
5. ادائيگين جي API
بنيادي رستو: /payments
ادائيگي ٺاهيو
POST /wu/v2/payments
Content-Type: application/json
{
"customer_id": 5,
"membership_id": 10,
"status": "completed",
"gateway": "stripe",
"gateway_payment_id": "pi_1234567890",
"total": 29.99,
"currency": "USD"
}
6. ڊومينن جي API
بنيادي رستو: /domains
ڊومين ميپ ڪريو
POST /wu/v2/domains
Content-Type: application/json
{
"domain": "custom-domain.com",
"customer_id": 5,
"primary_domain": 1,
"stage": "domain-mapping"
}