Create URL in Shortcuts app that contains two variables

This is the URL:

https://api.tomorrow.io/v4/weather/realtime?location=[Coordinates]&units=imperial&apikey=MyAPIKey

Where `[Coordinates]' is something like `33.4.-117.5'

I can get lat and long from Get current location, but can't form them into an acceptable URL

Text action: Latitude, Longitude

then

Set variable Coordinates to Text

Doesn't work. And many other combinations, but haven't hit the right one.


I am creating the Shortcut on Mac, then running from iPhone. I can sometimes run from the Mac, but then if I try again it fails.


Am I missing how to tag this with the Shortcuts app?

iPhone 17 Pro

Posted on Dec 11, 2025 4:52 PM

Reply
Question marked as Top-ranking reply

Posted on Dec 11, 2025 5:24 PM

I don't have access to your particular website but I simulated the same using flightradar24.com, which presents the longitude and latitude in the same format:



I ran successfully this shortcut several times on a Mac (macOS Sequoia 15.7.2) and an iPhone (iOS 26.1).

14 replies

Dec 12, 2025 7:03 AM in response to SoCalMtnBiker

In your 1st screenshot, the variable “URL” in the “Get Content of URL” action is undefined. Delete the variable and select the appropriate variable (the fist action.)


I’ve asked the hosts to mask the API key in your last 2 screenshots but I took the opportunity to test your specific website. (I’ll remove that information from my device once we find a solution to your issue.)


I believe you’ll be running into an authentication issue:



I ran this shortcut directly in the Shortcuts interface so the last thing on the screenshot is the output of the “Get Content of URL” action. The output shows an authentication error.


I don’t know what you need to do to authenticate yourself on this website and I don’t know if you can add your credentials to the URL. This would be a question for the website support team.

Dec 12, 2025 12:54 PM in response to SoCalMtnBiker

SoCalMtnBiker wrote:

Thanks again. How do you know "the variable “URL” in the “Get Content of URL” action is undefined?"

The variable URL is red, which means it does not refer to the URL action in the 1st screenshot:



The action "Get Contents of URL" can take either a variable (from the URL action, as in my example above) or a string-defined value, as shown below. In both cases, the URL has to be in a proper form/syntax as per HTTP and the website:



Note that "Get Contents of URL" is to return the content of the web page (as "data"), i.e. nothing is displayed in Safari. You have to then further process the resulting data to extract things of value to you. This can be cumbersome but, in some instance, easy if for instance the website returns only pure data (often in the form of json data.)


There are several websites that can help you with understanding Shortcuts, this one from Apple for instance: Intro to Shortcuts on Mac - Apple Support. But do not be fooled: it takes practice and trial and error to get a shortcut to work as desired. The learning slope is rather steep. I found that the best way to learn is through examples.


Please do send me your shortcut. I'll take a look at it and make suggestions. You can share a shortcut through iCloud. On the Mac for instance, right-click your shortcut, choose Share > Copy iCloud Link, validate by clicking the Share button. This will put the iCloud link in the clipboard. Paste the link to your reply here so that I can download it.


Could you also share how you intend to use the shortcut? I'm gathering from the link that the website gets some kind of weather data. Do you need to process the data (extracting some specific information, for instance)? Do you need to display the data somewhere? Do you need to save it?


Don't hesitate to post a screenshot of the actual content of the webpage as displayed in Safari when you normally use Safari to view the data (mask any personal information). This will give me an idea of what the data looks like.

Dec 12, 2025 6:38 AM in response to SoCalMtnBiker

Thank you. TLDR: ignore this response until I can run more trials.


When I do what you shows it works, but the error comes when I try to parse the Contents of the URL when it's constructed from variables. I thought I was getting closer, but I need to stop for now. All the following can be ignored and I'll try to get back to this tomorrow.


After about ten trials, I stripped it down to this and realize that the error is in how the URL is handled. This is the whole script and the error is the same with the Show alert removed.



I get the same "No URL Specified …" error. The URL is valid, I can copy it from the image (or from the alert popup) and it works in Safari.


Below is a bunch of stuff I tried thinking it was in how the variables were being handled, so irrelevant now to the discussion.



Which results in:


I could share the full script.


I also tried:


and this where I took out the Coordinates part to simplify it.



[Edited by Moderator]

Dec 12, 2025 12:26 PM in response to 6x6

Thanks again. How do you know "the variable “URL” in the “Get Content of URL” action is undefined?"


I am fighting two problems. 1) Even if I hardwire the coordinates, I get an error. 2) How to pass the coordinates in.


Either way I get the "No URL Specified" error. Although when I try to pass the coordinates I sometimes get a leading '%5C` (Not happening right now) in front of the coordinates. That is a '['.


I could send you my Shortcut since it's hard to see what each action is.. The API Key is a free access without any credit cards attached. Maybe I could get a second API key for testing purposes.


Are there any good sources for how Shortcuts are constructed? This one confuses me. "Get the contents of URLs passed into the action" sounds like the URL itself, not the contents of the page.

Dec 13, 2025 7:33 PM in response to 6x6

Thanks again. But 'variable' got me thinking I can get dew point for two places and put them both in the message. Haven't quite sorted out messaging, notifications and email yet. The automatic variables is confusing because I don't know which I'm referring to. Obviously if I get dew point twice I need to know which one's which. How long does the first "Get Dewpoint" value persist. Presumably getting Dewpoint a second time overwrite the first one.


I'm going to Leh, India next year so can add that as a second place to watch. Guess I should add ski area too.


Running trials now. And listening to old podcasts about Shortcuts and Automations.


PS. Thank you to the moderator as I apparently left in the API Key.

Dec 14, 2025 9:42 PM in response to 6x6

I can't define a second variable as detailed below.


Get weather at is working. However I now want to add a second location and defining a variable for each location seemed logical to me, but I don't understand Shortcuts variable. The third step does work, but doesn't make sense. What does the first "DewPointLocal" mean?


Dewpoint is getting into DewPointLocal variable, but to me the definition above should just have one entry since it's taking the input from above?


But the problem is that I can't define DewPointLey, the value is just that of DewPointLocal. I'm not getting an option to get the Weather symbol showing which I guess means it'a a variable.


Thanks for any help because I'm obviously missing something.


Create URL in Shortcuts app that contains two variables

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