Skip to main content

REST API ਹਵਾਲਾ

ਆਧਾਰ ਸੰਰਚਨਾ

ਆਧਾਰ URL: {site_url}/wp-json/wu/v2/ ਪ੍ਰਮਾਣੀਕਰਨ: API ਕੁੰਜੀ ਅਤੇ ਰਾਜ਼ (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

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"
}

ਰਜਿਸਟ੍ਰੇਸ਼ਨ ਅੰਤ-ਬਿੰਦੂ

/register ਅੰਤ-ਬਿੰਦੂ ਪੂਰਾ checkout/ਰਜਿਸਟ੍ਰੇਸ਼ਨ ਪ੍ਰਵਾਹ ਪ੍ਰਦਾਨ ਕਰਦਾ ਹੈ:

POST /wu/v2/register
Content-Type: application/json

{
"customer": {
"username": "newuser",
"password": "securepass123",
"email": "[email protected]"
},
"products": ["basic-plan"],
"duration": 1,
"duration_unit": "month",
"auto_renew": true,
"site": {
"site_url": "mynewsite",
"site_title": "My New Site",
"template_id": 1
},
"payment": {
"status": "completed"
},
"membership": {
"status": "active"
}
}

ਜਵਾਬ:

{
"customer": { ... },
"membership": { ... },
"payment": { ... },
"site": { "id": 123 }
}

ਸਵੈ-ਸਰਬਭੌਮ ਕਿਰਾਏਦਾਰ ਅੰਤ-ਬਿੰਦੂ

Ultimate Multisite: Multi-Tenancy 1.2.0 ਉਹਨਾਂ ਇੰਟੀਗ੍ਰੇਸ਼ਨਾਂ ਲਈ ਸਵੈ-ਸਰਬਭੌਮ ਕਿਰਾਏਦਾਰ REST ਕਵਰੇਜ ਜੋੜਦਾ ਹੈ ਜੋ ਅਲੱਗ-ਥਲੱਗ ਕਿਰਾਏਦਾਰਾਂ ਨੂੰ ਪ੍ਰਾਵਿਜ਼ਨ, ਜਾਂਚ ਜਾਂ ਤਸਦੀਕ ਕਰਦੇ ਹਨ।

ਸਟੀਕ ਬੇਨਤੀ ਪੇਲੋਡ ਸਮਰੱਥ ਹੋਸਟ ਸਮਰੱਥਾ ਉੱਤੇ ਨਿਰਭਰ ਕਰਦਾ ਹੈ, ਪਰ ਇੰਟੀਗ੍ਰੇਸ਼ਨਾਂ ਨੂੰ ਇਨ੍ਹਾਂ ਅੰਤ-ਬਿੰਦੂ ਸਮੂਹਾਂ ਦੀ ਉਮੀਦ ਕਰਨੀ ਚਾਹੀਦੀ ਹੈ:

POST /wu/v2/tenants/{site_id}/bootstrap
GET /wu/v2/tenants/{site_id}/migration-status
POST /wu/v2/tenants/{site_id}/verify
DELETE /wu/v2/tenants/{site_id}

ਕਿਰਾਏਦਾਰ ਰਜਿਸਟਰੀ, ਡਾਟਾਬੇਸ, ਫਾਈਲ ਸਿਸਟਮ ਅਤੇ ਰੂਟਿੰਗ ਸਥਿਤੀ ਤਿਆਰ ਕਰਨ ਲਈ bootstrap ਅੰਤ-ਬਿੰਦੂ ਵਰਤੋ। ਉਤਪਾਦਨ ਟ੍ਰੈਫਿਕ ਸਵਿੱਚ ਕਰਨ ਤੋਂ ਪਹਿਲਾਂ migration status ਅਤੇ verification ਅੰਤ-ਬਿੰਦੂ ਵਰਤੋ। ਸਵੈ-ਸਰਬਭੌਮ ਵਿਘਟਨ ਲਈ deletion ਅੰਤ-ਬਿੰਦੂ ਵਰਤੋ ਤਾਂ ਜੋ ਡਾਟਾਬੇਸ ਪ੍ਰਮਾਣ-ਪੱਤਰ addon cleanup ਪ੍ਰਵਾਹ ਰਾਹੀਂ ਹਟਾਏ ਜਾਣ।

ਆਮ migration status ਜਵਾਬਾਂ ਵਿੱਚ ਸ਼ਾਮਲ ਹੁੰਦੇ ਹਨ:

{
"site_id": 123,
"isolation_model": "sovereign",
"database_host": "localhost",
"verification": {
"no_legacy": "passed",
"sovereign_push": "passed",
"tenant_users": "passed"
},
"ready": true
}

ready: false ਨੂੰ ਪ੍ਰੀ-ਲਾਂਚ ਰੋਕ ਵਜੋਂ ਮੰਨੋ। verification ਵੇਰਵਿਆਂ ਦੀ ਜਾਂਚ ਕਰੋ, ਡਾਟਾਬੇਸ ਹੋਸਟ ਬਾਈਂਡਿੰਗ, ਕਤਾਰ, ਵਰਤੋਂਕਾਰ ਪ੍ਰਾਵਿਜ਼ਨਿੰਗ ਜਾਂ ਰੂਟਿੰਗ ਸਮੱਸਿਆ ਠੀਕ ਕਰੋ, ਫਿਰ verification ਮੁੜ ਕੋਸ਼ਿਸ਼ ਕਰੋ।

ਗਲਤੀ ਜਵਾਬ

{
"code": "wu_rest_invalid_parameter",
"message": "Invalid parameter value",
"data": {
"status": 400,
"params": {
"email": "Invalid email format"
}
}
}

ਪੇਜੀਨੇਸ਼ਨ ਅਤੇ ਫਿਲਟਰਿੰਗ

ਕੁਐਰੀ ਪੈਰਾਮੀਟਰ:

GET /wu/v2/customers?per_page=20&page=2&search=john&status=active

ਆਮ ਪੈਰਾਮੀਟਰ:

  • per_page - ਪ੍ਰਤੀ ਪੰਨਾ ਆਈਟਮਾਂ (ਮੂਲ: 20, ਅਧਿਕਤਮ: 100)
  • page - ਪੰਨਾ ਨੰਬਰ
  • search - ਖੋਜ ਸ਼ਬਦ
  • orderby - ਛਾਂਟਣ ਵਾਲਾ ਖੇਤਰ
  • order - ਛਾਂਟਣ ਦੀ ਦਿਸ਼ਾ (asc/desc)
  • status - ਸਥਿਤੀ ਅਨੁਸਾਰ ਫਿਲਟਰ ਕਰੋ
  • date_created - ਮਿਤੀ ਦੀ ਸੀਮਾ ਅਨੁਸਾਰ ਫਿਲਟਰ ਕਰੋ