REST API Reference
Base URL
Section titled “Base URL”/wp-json/webtriad-awl/v1/Endpoints
Section titled “Endpoints”Get Wishlist
Section titled “Get Wishlist”Get wishlist with items.
GET /wishlistQuery Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
page | int | 1 | Page number |
per_page | int | 10 | Items per page (max 20) |
Response:
{ "id": 1, "user_id": 5, "status": "active", "created_at": "2024-01-01 12:00:00", "updated_at": "2024-01-01 12:00:00", "items": [ { "id": 1, "wishlist_id": 1, "product_id": 123, "variation_id": 0, "quantity": 1, "attributes": {}, "added_at": "2024-01-01 12:00:00" } ], "pagination": { "total": 15, "page": 1, "per_page": 10, "total_pages": 2 }}Add Item
Section titled “Add Item”Add product to wishlist.
POST /wishlist/itemsBody:
{ "product_id": 123, "variation_id": 0, "quantity": 1, "attributes": {}}Response:
{ "id": 1, "wishlist_id": 1, "product_id": 123, "variation_id": 0, "quantity": 1, "attributes": {}, "added_at": "2024-01-01 12:00:00"}Remove Item
Section titled “Remove Item”Remove product from wishlist.
DELETE /wishlist/itemsBody:
{ "product_id": 123, "variation_id": 0}Response:
{ "success": true}Add All to Cart
Section titled “Add All to Cart”Add all wishlist items to cart.
POST /wishlist/add-all-to-cartResponse:
{ "success": true, "added": 5, "failed": 2, "message": "5 item(s) added to cart. 2 item(s) could not be added."}Get Dashboard Stats
Section titled “Get Dashboard Stats”Get dashboard statistics (admin only).
GET /dashboard/statsResponse:
{ "total_wishlists": 150, "total_items": 450, "guest_wishlists": 50, "user_wishlists": 100}Get Top Products
Section titled “Get Top Products”Get top wishlisted products (admin only).
GET /dashboard/top-productsQuery Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | int | 10 | Number of products |
Response:
[ { "product_id": 123, "product_name": "T-Shirt", "count": 45 }]Get Settings
Section titled “Get Settings”Get plugin settings (admin only).
GET /settingsResponse:
{ "wishlist_page": { "wishlist_page_id": 5, "require_login": false, "redirect_guests": false }, "product_page": { "enabled": true, "position": "below_add_to_cart" }}Update Settings
Section titled “Update Settings”Update plugin settings (admin only).
POST /settingsBody:
{ "wishlist_page": { "wishlist_page_id": 5 }, "product_page": { "enabled": true, "position": "below_add_to_cart" }}Response:
{ "success": true, "settings": { }}Error Responses
Section titled “Error Responses”All endpoints return standard WordPress REST API errors:
{ "code": "rest_invalid_param", "message": "Invalid parameter(s): product_id", "data": { "status": 400 }}Common Error Codes
Section titled “Common Error Codes”| Code | Status | Description |
|---|---|---|
rest_invalid_param | 400 | Invalid parameter |
rest_forbidden | 403 | Permission denied |
wishlist_not_found | 404 | Wishlist not found |
item_not_found | 404 | Item not found |
wishlist_error | 500 | General wishlist error |