Use this pre-built prompt to get an agent writing SudoMock HTTP calls correctly.
Prerequisites
Before you start, you’ll need:- A SudoMock API key
- A PSD reachable over HTTPS
- PHP 7.4 or newer with the curl extension, which
php -mlists
Guide
1
Set your API key
Keep the key in the environment so it never reaches source control.
Shell
2
Upload the PSD once
Both calls post JSON to the same host, so they share one helper. The
timeout matters: a render holds the connection until the image is ready,
and PHP’s default cuts it off first.Run the upload from the command line, never from a route, and put the two
UUIDs it prints in the environment the route will run in.
sudomock.php
upload.php
3
Render from a route
The route takes an artwork URL and answers with the finished image, passing
a failure’s Serve it with
error_code through instead of swallowing it.render.php
php -S localhost:8000 from the shell holding the key and
the two UUIDs.Examples
Create a mockup from a PSD
The call behind
upload.phpRender a PSD mockup
Every field of the render body
Fit and blend modes
What
fit does to the artworkRetrieve a single job
Collect an async render
Create a webhook endpoint
Get called back instead of polling
Create a mockup from a product photo
Start from a photo, not a PSD
Render a photo mockup
The second call of that flow
Error codes
Every code and which to retry