Skip to content

Instantly share code, notes, and snippets.

@andrewdolphin
Last active February 4, 2024 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewdolphin/a7dff49505e588d940bec55132fab8ad to your computer and use it in GitHub Desktop.
Save andrewdolphin/a7dff49505e588d940bec55132fab8ad to your computer and use it in GitHub Desktop.
Linkding iOS Share Sheet shortcut using API (no login needed) and allowing tagging with existing tags
Having tried a couple of the previous shortcut solutions for iOS I was convinced something easier was possible using the API. The below is my first proper go at putting something together.
This shortcut will be available when "sharing" a URL from within a browser on iOS. On sharing to this shortcut it will automatically pull all available tags from the Linkding server and allow multi-tagging for the URL.
Limitations:
- Currently only previously defined tags can be used
- Title will rely on the automatic process on the server, manual override isn't available
- The same applies to the description
- Tags are currently listed in the order they were created. Alphabetical would make more sense.
The shortcut can be found at the link below. Clicking the link on an iOS device should open a web page allowing you to install the shortcut.
In order to set the shortcut up, within the **TWO** "Get contents of URL" actions the URL will need to have [base_url] replaced with your own Linkding server address. Similarly [API_Token] needs to be replaced (leaving the word Token in place before it) with the REST API token that can be found in the Settings section of the Linkding web ui under the Integrations tab.
Now the url:
https://www.icloud.com/shortcuts/97a516940fb64d039446eba1ed616b9d
Dev notes:
iOS shortcuts can't seem to very easily allow include the list/array in the Json body of the API request. After a decent amount of googling I found the solution used, to create the full Json body as text and to include that as a File to the API request whilst setting the text type to Dictionary.
@rghedin
Copy link

rghedin commented Dec 17, 2023

This is awesome, thanks!

One request: is it possible to add a toggle/menu that allows me to set a saved link as unread?

@Drudoo
Copy link

Drudoo commented Dec 18, 2023

Where exactly do you put in the API token? I see the two places to add the base url but I can’t seem to find where to add the API key.

@andrewdolphin
Copy link
Author

Within the "get contents of" action hit the dropdown then look at the headers section

@Drudoo
Copy link

Drudoo commented Jan 8, 2024

I get an error, "get contents of url failed because shortcuts couldn't convert from rich text to url" I'm only using linkding locally, put my local address and port number for linkding in the get contents of section, as well as the token beneath. I'm not sure what I'm doing wrong.

I get the error from time to time too. It’s frustrating because it is only with some links.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment