Appearance
WP Social Ninja REST API
Complete REST API reference for WP Social Ninja and WP Social Ninja Pro. Endpoints are organized by module, with parameters, response shapes, and examples on each page.
Getting Started
Base URL: https://your-site.com/wp-json/wpsocialreviews/v2
The namespace and version come from config/app.php:
php
'rest_namespace' => 'wpsocialreviews',
'rest_version' => 'v2',These are admin endpoints. Every request must carry a valid WordPress REST nonce for a logged-in user, and the route group's policy authorizes the specific capability.
Authentication
From the admin Vue SPA — use the global $get / $post / $put / $del / $patch helpers registered in resources/admin/main.js. They attach the X-WP-Nonce header automatically.
js
const { data } = await $get('platforms/enabled')From outside — send the nonce header with the logged-in cookie:
bash
curl -X GET "https://your-site.com/wp-json/wpsocialreviews/v2/platforms" \
-H "X-WP-Nonce: <nonce>" \
--cookie "wordpress_logged_in_xxx=..."Conventions
- Paths below are relative to the base URL
…/wpsocialreviews/v2. - Path parameters like
{id}are integers (routes declare->int('id')). - Collection endpoints commonly accept
pageandper_page(defaultper_page=10) and sometimessearch. - Handlers are shown as
Controller@method(controllers inapp/Http/Controllers/). - The REST namespace is
wpsocialreviews/v2.
API Modules
Core Resources
| Module | Group(s) | Description |
|---|---|---|
| Platforms | platforms | Platform status, statuses, dashboard notices, add-ons, and review/feed connection configs |
| Reviews & Testimonials | reviews, testimonials | Manage custom reviews and testimonials (shared route set) |
| Templates | templates | Templates and their reviews/feeds meta |
Configuration
| Module | Group(s) | Description |
|---|---|---|
| Settings | settings | Global settings, license, translations, advanced settings, data reset |
| Chat Widgets | chat-widgets | Chat widgets and their chat meta |
Content
| Module | Group(s) | Description |
|---|---|---|
| Shoppable | shoppable | Shoppable posts and template settings |
| Notifications | notifications | Notification popups |
| Pages & Onboarding | pages, onboarding | Page search and the setup wizard |
Pro Features
| Module | Group(s) | Description |
|---|---|---|
| Pro API | pro, pro/settings, pro/review-forms, pro/custom-sources | Managers, QR codes, WooCommerce/FluentCart imports, review forms, custom sources |
TikTok
Custom Feed for TikTok registers no REST routes. It renders through the core [wp_social_ninja] shortcode (platform="tiktok"), the wp_ajax_wpsr_get_more_feeds handler, and the wpsocialreviews/render_tiktok_template filter. See Custom Feed for TikTok.
Permission System
Each route group is guarded by a policy class in app/Http/Policies/ that authorizes the request against a WP Social Ninja capability. The admin capability used for most checks is filterable via wpsr_admin_permission (default manage_options).
| Group | Policy |
|---|---|
platforms/* | PlatformPolicy |
reviews / testimonials | ReviewPolicy / TestimonialPolicy |
settings, pro | SettingsPolicy |
chat-widgets | WidgetsPolicy |
shoppable | ShoppablePolicy |
notifications | NotificationsPolicy |
pages / onboarding | PagesPolicy / AdminPolicy |
templates | TemplatePolicy |
pro/review-forms / pro/custom-sources | ReviewFormPolicy / CustomSourcesPolicy |
See Policies & Authorization for how policies work and Registering Endpoints to add your own.
Error Handling
Responses use standard WordPress REST error envelopes. A failed policy check returns 403; validation and business-logic errors typically return 422 with a message (and sometimes errors) key.
| Status | Meaning |
|---|---|
200 | Success |
403 | Forbidden — the policy denied the request |
404 | Not Found — resource does not exist |
422 | Unprocessable — validation or business-logic error |

