Commit graph

13 commits

Author SHA1 Message Date
DJP
45b4067150 Create simplified uploader matching exact standalone script
AssetUploaderSimple - exact copy of standalone logic:
- Only 5 metadata fields (not 17)
- Same field order and structure
- Same cURL options
- Produces ~1200 byte payload like standalone

Test upload now uses AssetUploaderSimple for exact match.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 09:12:51 -04:00
DJP
276101a7db Add code version marker to verify cache 2025-10-28 09:05:20 -04:00
DJP
50c30139bf Add detailed logging to debug web vs CLI difference 2025-10-28 09:04:53 -04:00
DJP
f80424197d Match AssetUploader to working standalone script approach
BREAKTHROUGH: Standalone script successfully uploaded with HTTP 202!
Job ID: 214651

Changes to match working standalone:
- Always use full Postman metadata structure
- Fix field order: asset_representation, parent_folder_id, manifest, files
- Ensure Bearer token doesn't have double 'Bearer' prefix
- Match exact cURL options from standalone

Standalone test proved:
 OAuth credentials work for uploads
 Endpoint is correct
 Metadata structure is correct
 Folder allows uploads
 File extensions are allowed

Issue was in main workflow implementation, not API restrictions!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 08:48:58 -04:00
DJP
abd9c01ff5 Add cookie/session handling to uploads - potential missing piece
Added CURLOPT_COOKIEJAR and CURLOPT_COOKIEFILE to maintain JSESSIONID.

Successful Postman cURL includes:
Cookie: JSESSIONID=916FDCDDBF50464F2D7A27AF28E90E20

This session cookie might be required in addition to OAuth token.
Cookie jar will persist session across requests.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 08:31:19 -04:00
DJP
058ec66af0 Match EXACT Postman structure - all metadata fields from successful cURL
Replicated complete asset_representation from client's successful Postman upload:
- All 17 metadata fields from working cURL
- Tabular fields: MAIN_LANGUAGES, ASSETCOMPLIANCE, MARKETING_TAG, TYPE_VID
- Domain value fields with field_value structure
- All required fields: MKTG.ASSET TYPE, FISCAL YEAR, STATE, etc.
- ECOMMERCE model + security policy 1594

This is the EXACT structure that returned 202 Accepted for the client.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 08:28:10 -04:00
DJP
7f76129364 Add URL verification to upload debug output
Shows exact upload URL being used and verifies it matches Ferrero's confirmed endpoint.

Debug output now displays:
- Actual upload URL being called
- Expected URL (from Ferrero tech team)
- URL match verification (YES/NO)

This confirms we are using the correct endpoint:
https://ppr.dam.ferrero.com/otmmapi/v6/assets

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 12:57:15 -04:00
DJP
ed4e578850 Use Postman collection asset_representation structure for uploads
Match exact metadata structure from working V3 Postman collection:
- ECOMMERCE metadata model
- Security policy ID 1594
- Required metadata fields:
  - FERRERO.FIELD.MKTG.ASSET TYPE = heroimage
  - FERRERO.FIELD.FISCAL YEAR = 2025/2026
  - ARTESIA.FIELD.ASSET NAME = uploaded filename
  - FERRERO.FIELD.STATE = Local
- Normalize MIME type (image/jpg → image/jpeg)
- Structure confirmed working by Ferrero tech team in Postman

This matches the asset_representation from the V3 collection
that successfully uploads files.
2025-10-24 12:13:48 -04:00
DJP
079ae37ea5 Fix upload crash - remove undefined tryPostmanUpload method call 2025-10-24 11:47:40 -04:00
DJP
0ebdf5c755 Disable master assets fetching in upload - causes PHP crashes
Upload workflow issues:
- Master asset metadata structures too large for PHP to process
- Causes session storage crashes and HTTP 500 errors
- Temporarily disabled master assets fetching
- Upload folder finding still works

Current upload status:
- ALL file extensions (.tif, .jpg, .png) rejected by API
- Error: "Cannot import asset having restricted file extension"
- Tested with minimal payloads (just manifest + folder + file)
- Suggests server-level restrictions or account permissions issue

Awaiting client confirmation on:
- API upload permissions for user account
- Allowed file extensions for API uploads
- Alternative upload methods if API is restricted

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 11:17:26 -04:00
DJP
4f5ac8bfe7 Add standalone Upload workflow with master asset metadata selection
Upload Workflow Improvements:
- Fetch master assets metadata when finding upload folder (standalone workflow)
- Add UI selector to choose which master asset's metadata to copy
- Show master asset details: name, type, metadata model, security policies
- Add comprehensive upload debug output showing file/metadata info
- Add "Reset to A1" button in Upload tab for testing
- Default to first master asset if none selected

Upload Implementation Progress:
- Tried multiple approaches to bypass file extension restrictions
- Current status: All file extensions blocked by API (jpg, tif, png)
- Minimal upload attempt: manifest + security_policy + parent_folder
- Issue: "Cannot import asset having restricted file extension" for all types
- Suggests API upload restrictions or account-level permissions needed

Technical Details:
- Upload endpoint: /v6/assets (POST with multipart/form-data)
- Required fields: manifest, parent_folder_id, files, asset_representation
- Security policy ID: 1594 (from V3 collection)
- File extension restrictions appear to be server/account level

Next Steps:
- Verify API upload permissions with client
- Check allowed file extensions for API uploads
- May need different upload approach or web interface integration

Working Features:
-  Download workflow (A1 → A2) fully functional
-  Status updates working with proper locking
-  Master asset metadata fetching and selection
- 🔄 Upload blocked by file extension restrictions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 09:50:43 -04:00
DJP
156f9ae51d Fix status updates and enhance workflow with proper error handling
Major improvements to workflow_v3.php and supporting classes:

**Status Updates (A1→A2, A2→A3, A5→A6):**
- Fix StatusManager to use correct PATCH endpoint: /v6/folders/{id}
- Add lock_strategy=optimistic parameter to prevent locking errors
- Update request body structure to use edited_folder format
- Status updates now working correctly

**Status Field Extraction:**
- Fix CampaignFormatter to extract CONTENT.SCALING.STATUS field
- Handle domain values with field_value.value path
- Now correctly filters campaigns by status (A1, A2, A5, etc.)

**Error Handling:**
- Extract and display actual API error messages
- Show HTTP status codes in all error messages
- Add expandable debug panels with full API responses
- Enhanced upload error reporting with detailed diagnostics

**Campaign Search:**
- Update to use Postman collection requests directly (avoids 503 errors)
- Fix URL encoding (rawurlencode instead of urlencode)
- Add comprehensive debug output showing OAuth status and API responses
- Search now attempts Postman request first, falls back to manual query

**Upload Improvements:**
- Rewrite AssetUploader to use native PHP CURLFile for multipart uploads
- Add support for additional file types: .mov, .mp4, .avi, .zip, .txt, .doc, .xlsx
- Increase max upload size to 100MB for video files
- Simplify asset_representation to minimal structure
- Add infrastructure to inherit metadata from master assets

**Testing Features:**
- Add "Reset to A1" button for testing workflow iterations
- Add debug mode to view all campaigns and their metadata
- Show Content Scaling Status on all campaign cards
- Display filtering debug info (total vs filtered counts)

**UI Improvements:**
- Rename buttons to clarify "Content Scaling Status" terminology
- Add status badges to campaign cards showing current status
- Better visual feedback for successful/failed operations

Current Status: Workflow A1→A2 fully working. Upload A2→A3 ready for testing
once DAM server recovers from HTTP 503 errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-23 16:43:09 -04:00
DJP
cf71bcfd96 Complete workflow V3: Add Upload (A2→A3) and Rework (A5→A6) workflows
NEW: Upload Workflow (A2→A3)
- Load campaigns with status A2 (assets sent to agency)
- Select campaign and find upload target folder (Final Assets)
- Multi-file upload with drag-drop interface
- AssetUploader class with multipart/form-data support
- Upload files with metadata to DAM
- Update status to A3 after upload

NEW: Rework Workflow (A5→A6)
- Load campaigns with status A5 (rework needed from agency)
- Select campaign and get rework assets
- Download individual or bulk rework assets
- Beautiful metadata display
- Update status to A6 when rework assets received

Features:
- Three complete workflow tabs (Download, Upload, Rework)
- Status transitions: A1→A2, A2→A3, A5→A6
- Session-based workflow state management
- Clear workflow data button for each tab
- Campaign selection with visual feedback
- Download confirmed working (tested with real asset)
- OAuth2 auto-refresh throughout all workflows

Technical:
- AssetUploader class for multipart file uploads
- Proper metadata JSON structure for uploads
- Support for multiple file formats (JPG, PNG, PDF, AI, PSD, etc.)
- Error handling for each workflow step
- Beautiful UI with color-coded status badges

Ready for testing with real campaign data!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-17 16:43:26 -04:00