Getting Started with APIs in Shortcuts

Hey all,

I’m looking to expand the possibilities of my shortcuts usage by plugging myself into the almost infinite number of web APIs out there and the info they can provide. I decided to explore Twitter as a “simple” start point but I’m struggling due to not understanding the concept of the “Get contents of” action in Shortcuts.

I have set up an app in Twitter dev and have my bearer token and set about creating this shortcut for just getting some details about a profile (eventually, I’d like to get the profile picture for a profile).

As I understand it, the URL that I need to ‘Get contents of’ is the API’s Endpoint URL.
From there, I understand I need to use GET.

This is where I start to lose the plot a bit.

I cannot work out how the various pieces of what I’m trying to achieve fit into the fields in the action - I.e. How do I tell it what parameters I want to feed in (e.g. I want info relating to a specific user name), how to I tell it what information I want to return (e.g. profile picture) and what is the right way of authorization?

I’ve tried to make a start here but not really made any progress and what I have done returns a 401 error.

https://www.icloud.com/shortcuts/c72975153772425e83279a38f6ec813d
Any help would be greatly appreciated.

Here is a Shortcut that gets the details from a Username.

https://www.icloud.com/shortcuts/8f8a09ecf0c24bb39e673e18f7d8dd12

Here is the documentation that found regarding it

Hope this helps you. Let me know if you have any further questions.