Apple Shortcuts CLI command to get Dropbox file hyperlink
I want to use a CLI command to run an Apple Shortcut that will take a file path as input and return the Dropbox link as output (to a file or clipboard etc). Unfortunately, I am getting errors when a file path is provided. The details are described below:
On macOS Sonoma (14.2.1) (MacBook Pro M1) Apple Shortcuts App provides a step called 'Get Dropbox File' and 'Get link to Dropbox File' ... the idea is that when you run the Shortcut you are asked to select a Dropbox file and it will return the Dropbox hyperlink to the file. When run manually this Shortcut works fine and the hyperlink is copied to my clipboard
However, Apple Shortcuts can also be run from the command line and syntax they provide is as follows:
shortcuts run "Get DropBox Hyperlink CLI" -i <file-path>
where 'Get DropBox Hyperlink CLI' is the name of my Shortcut and 'file-path' is the file-path to a file in my Dropbox 'Public' folder, e.g. /Users/garry/Library/CloudStorage/Dropbox/Public/file.txt
In order to remove the action in the 'Get Dropbox File' step to select a file manually, the 'Show Document Picker' checkbox is unticked and the 'Shortcut Input' selected so that the file path can be sent as a parameter to the CLI command
If I execute the Shortcut from the command line when manual selection of the file is requested (screenshot 1) all works well:
shortcuts run "Get DropBox Hyperlink Manually"
However, when I execute the Shortcut from the command line and supply the file path to a single file as an argument then I get errors:
shortcuts run "Get DropBox Hyperlink CLI" -i <file-path"
Typically the error is:
"Error: An unknown error occurred (too_many_requests/...)"
The file path is to a single file and there is only one other file in the same folder.
The problem is, I don't know if this is a Dropbox, Shortcuts or syntax error causing the issue? Any help appreciated !
P.S. When the 'Get Dropbox File' step is first run, Dropbox requested permission for Shortcuts App to use their API and I granted this.
MacBook