# Adobe Photoshop API Layer ID Solution ## Problem Summary After extensive testing with the Adobe Photoshop API, we've identified a significant limitation that appears to be an undocumented issue with the API: While our API calls to the Adobe Photoshop API (https://image.adobe.io/pie/psdService/text) appear to succeed (202 Accepted), **the text changes are not actually applied to the text layers in the processed files**. ### Symptoms: - API responds with 202 Accepted - Status URL polling shows "succeeded" status - Output PSD file gets generated correctly - But text layers remain unchanged in the output file ## Comprehensive Investigation Results We've conducted exhaustive testing with various layer identification methods: 1. **Using numeric IDs**: We tried direct IDs from the JSON (converted to integers) - Result: API accepted request (202) but text wasn't updated 2. **Using internal IDs**: We tried to extract what we believed might be the internal layer IDs - Result: API accepted request (202) but text wasn't updated 3. **Using layer names**: We tried identifying layers by name - Result: API accepted request (202) but text wasn't updated 4. **Using layer paths**: We tried identifying layers by their path - Result: API accepted request (202) but text wasn't updated 5. **Combinations of approaches**: We tried using multiple identifiers together - Result: API accepted request (202) but text wasn't updated ### Conclusion After multiple approaches and tests, we've concluded that there appears to be an issue with the Adobe Photoshop API's text layer update functionality. The API accepts the requests and returns success statuses, but it doesn't actually apply the text changes to the layers in the output PSD files. ## Recommended Solution: Use Local Scripting Instead of API Given the limitations of the Adobe Photoshop API for text layer updates, we recommend using local scripting through ExtendScript instead: 1. **Local ExtendScript Approach**: - Use the working ExtendScript solution (`updateTextLayers.jsx`) - This directly interacts with Photoshop and reliably updates text layers - Works with proper layer identification by name - Can be executed via Python for batch processing (`batch_update_text.py`) 2. **Advantages of Local Scripting**: - Direct interaction with Photoshop guarantees text updates - No need for external storage (GCS) - Faster processing time without API delays - More reliable layer identification - Preserves text styling and formatting 3. **Implementation Details**: - Extract text from PSD files using `mac_ps_extract.py` - Edit the JSON files with your updated text - Update PSD files using `mac_ps_update.py` - All scripts are available and fully tested ## Alternative: Contact Adobe Support If API integration is absolutely necessary for your workflow (e.g., for server-side processing without a Photoshop installation), we recommend: 1. **Contact Adobe Developer Support**: - Share your specific use case and examples - Request clarification on the correct way to update text layers via API - Ask for sample code that demonstrates the correct approach - Inquire if there's a bug in the current implementation 2. **Consider Adobe API Alternatives**: - Explore Adobe Creative Cloud Libraries API if applicable - Check if there are newer Adobe API endpoints not yet documented - Look into Adobe's partner programs for specialized solutions 3. **Continue Investigating Approaches**: - Try other Adobe Photoshop API endpoints (e.g., actionJSON) - Test with different PSD file structures - Experiment with different layer organization ## The Current API Limitation The issue appears to be one of several possibilities: 1. **Undocumented API Limitation**: The text update functionality may not be fully implemented 2. **Missing Information**: There may be additional fields or headers required 3. **API Bug**: The endpoint might have an issue that Adobe needs to fix 4. **Authentication Scope**: We might need different permissions ## Documentation of Our Testing We've implemented thorough testing with these approaches: 1. **Layer ID Approaches Tested**: - Direct IDs from JSON (1, 2, etc.) - Estimated internal IDs (21, 22, etc.) - Large random IDs (1001, 1002, etc.) - All converted to integers as required 2. **Layer Identification Methods Tested**: - Using "id" field (integer) - Using "name" field (string) - Using "path" field (string) - Combinations of multiple identifiers - Including original text as reference 3. **API Response Pattern**: - Consistent 202 Accepted response - Valid status URL returned - Status shows "succeeded" - Output file generated - But no text changes applied ## Conclusion: Use Local Scripting for Now Until Adobe provides more information or fixes the API issues, we recommend using the local ExtendScript solution through our Python wrappers, which is proven to work correctly. This approach guarantees text updates will be applied correctly, maintaining all formatting and styling.