GetReal Labs - WordPress API Endpoint Fix

Date: 2025-11-07 Status: ✅ FIXED Issue: 404 Error when fetching task JSON URLs


Problem

The application was returning a 404 error when trying to fetch task JSON URLs from the WordPress REST API:

Error: Failed to get JSON URLs: 404

Root Cause

The wordpress.ts API client was using incorrect endpoint URLs. The implementation was using the generic ypai/v1 namespace instead of the correct ypai-video/v1 namespace from the YPAI Video Uploader Plugin v1.2.0.

Wrong Endpoints:

Correct Endpoints:


Changes Applied

1. WordPress API Client (src/api/getreal/wordpress.ts)

Fixed three endpoint URLs:

Line 17 - getTaskJsonUrls():

// BEFORE (wrong)
const url = `${getBaseUrl()}/wp-json/ypai/v1/json-urls?participant_id=${encodeURIComponent(
  participantId
)}&secret=${encodeURIComponent(SECRET)}`;

// AFTER (correct)
const url = `${getBaseUrl()}/wp-json/ypai-video/v1/task-json-urls?participant_id=${encodeURIComponent(
  participantId
)}&secret=${encodeURIComponent(SECRET)}`;

Line 38 - getUploadUrls():

// BEFORE (wrong)
const url = `${getBaseUrl()}/wp-json/ypai/v1/upload-urls?secret=${encodeURIComponent(SECRET)}`;

// AFTER (correct)
const url = `${getBaseUrl()}/wp-json/ypai-video/v1/upload-urls?secret=${encodeURIComponent(SECRET)}`;

Line 64 - verifyUploads():

// BEFORE (wrong)
const url = `${getBaseUrl()}/wp-json/ypai/v1/verify-uploads?secret=${encodeURIComponent(SECRET)}`;

// AFTER (correct)
const url = `${getBaseUrl()}/wp-json/ypai-video/v1/verify-uploads?secret=${encodeURIComponent(SECRET)}`;

2. Configuration File (src/config/getreal.config.ts)

Updated endpoint documentation:

wordpress: {
  baseUrl: 'https://yourpersonalai.net',
  endpoints: {
    taskJsonUrls: '/wp-json/ypai-video/v1/task-json-urls',  // ← Updated
    uploadUrls: '/wp-json/ypai-video/v1/upload-urls',        // ← Updated
    verifyUploads: '/wp-json/ypai-video/v1/verify-uploads',  // ← Updated
  },
},

3. README (src/pages/getreal/README.md)

Updated API documentation section to reflect correct endpoints and plugin version:

Endpoints (YPAI Video Uploader Plugin v1.2.0):
- `/wp-json/ypai-video/v1/task-json-urls?participant_id={id}` - Get task JSON URLs
- `/wp-json/ypai-video/v1/upload-urls` - Get presigned S3 upload URLs
- `/wp-json/ypai-video/v1/verify-uploads` - Verify all uploads complete

4. Implementation Complete Doc (src/pages/getreal/IMPLEMENTATION-COMPLETE.md)

Marked WordPress endpoints as fixed and updated documentation.


WordPress Plugin Details

Plugin Name: YPAI Video Uploader Version: v1.2.0 Namespace: ypai-video/v1

Endpoints Overview

  1. GET /wp-json/ypai-video/v1/task-json-urls

  2. POST /wp-json/ypai-video/v1/upload-urls

  3. POST /wp-json/ypai-video/v1/verify-uploads


Testing

Dev Server Status

✅ Dev server running on http://localhost:4065/

Pages Status

Next Steps for Testing

  1. Test with Real Participant ID:

    http://localhost:4065/getreal/record?participant_id=01234&session_id=test-session&source=Prolific
    
  2. Verify API Calls:

  3. Test Full Flow:


Source of Truth

Documentation: T:\Obsidian\YPAI\Clients\GetReal Labs\Gesture Data Collection\Gesture Data Collection.md

This Obsidian document contains the complete WordPress plugin documentation including:


Impact

Resolved: 404 errors when fetching task JSON URLs ✅ Benefit: Application can now communicate with WordPress REST API ✅ Next: Ready for end-to-end participant flow testing


Fix Applied: 2025-11-07 Files Modified: 4 (wordpress.ts, getreal.config.ts, README.md, IMPLEMENTATION-COMPLETE.md) Lines Changed: 12 lines across 4 files