Remembering that BROCK's trainer ID from the previous step is 34, we can verify that the image matches as well by sending a request to the GET /v1/trainers/pics/:trainer_id
endpoint:
curl \
-H 'Authorization: Bearer <access_token>' \
-J -O \
https://api.pkmnapi.com/v1/trainers/pics/34
This should download a PNG named "ROCK .png" (because we changed BROCK's name earlier)
Now let's replace that image with one of our own, an image of a rock:
We have sized this image to be the same size as BROCK's (56x56). The image is also 2-bit grayscale and contains only the allowed color palette:
To replace a trainer's pic, send a request to the POST /v1/trainers/pics/:trainer_id
endpoint:
curl \
-X POST \
-H 'Authorization: Bearer <access_token>' \
-H 'X-Patch-Description: Make BROCK look like a rock' \
-H 'Content-Type: image/png' \
--data-binary @path/to/rock.png \
https://api.pkmnapi.com/v1/trainers/pics/34
Should be a success. Let's check again to make sure:
curl \
-H 'Authorization: Bearer <access_token>' \
-J -O \
https://api.pkmnapi.com/v1/trainers/pics/34
This, too, rocks!
Behold, the final result: