I struggled a bit with photo uploads through the iOS Shortcuts all. The interface for creating scripts is a little janky...still. After struggling with the logic of the photos script, I realized that it was a problem with the interface that was borking things for me.
Basically, the script calls a Get Contents of URL action to send a POST request to the API. The photo is included as a file in the form data. When you add a field to the form data in Shortcuts, it defaults to a text field, but allows you to change it to "file" when tapping on it. This doesn't actually change the field to a file, though. Rather, it allows you to pick text attributes of a file to send as text. I had changed it to File, and thought, for hours, that I was in fact sending a file.
I finally reconstructed the action from scratch, adding each field one by one. When initially adding fields, a separate text v. file option appears. Setting that to File actually sets the field as a file. In the list of fields, the file fields are right-aligned while the text fields are left aligned. I wish I would have known that a couple hours ago!
Anyways, the Shortcut is now working. First photo posted through the Drafts-Shortcuts-API conduit coming next!
post published in /2021/10/11