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

Posted on Feb 2, 2024 6:45 AM

Reply

Similar questions

3 replies

Feb 2, 2024 7:13 AM in response to planserendipity

I don't use DropBox, and I recommend you try the following:


shortcuts run "Get DropBox Hyperlink CLI" --input-path filepath


Shortcuts does not document a -i switch alternative in place of the --input-path argument. I tested this syntax with one of my QA shortcuts and it popped two dialogs requesting the Finder involvement to write the split PDF .jpeg images to a folder. On both dialogs, I clicked Always Allow.


shortcuts run "Split PDF into images" --input-path ~/Desktop/4pager.pdf


with this result:



Tested: macOS Sonoma 14.3.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Apple Shortcuts CLI command to get Dropbox file hyperlink

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.