You can easily download and run the workflow directly in your KNIME installation. We recommend that you use the latest version of the KNIME Analytics Platform for optimal performance. It can also be deployed as a Data App in KNIME Business Hub.
As you may notice, the workflow nodes are currently not executed (indicated by the red light) because first, you must create a Spotify App within your account. This process is straightforward. Follow the step-by-step guide in the External resources section titled "How to create a Spotify App - Docs."
The next step is to retrieve your Client ID and Client Secret from your recently created Spotify App. To do this, click on your app name and then "Settings". Copy and paste the values into the "String Configuration" nodes to complete the process.
First, let's take a look at the steps for configuring the "OAuth2 Authenticator (Client Credentials)" node:
1. As "Token endpoint URL": https://accounts.spotify.com/api/token
2. To pass the credentials (Client ID and Secret) into the node, select "credentials."
3. We must input a random scope from the list of scopes in the External Resources section.
4. Click "Show advanced settings," then input gran_type=client-credentials in "Additional request fields" for node authorization flow.
Regarding the Client Credentials authorization flow is essential to notice that "Clients use the Client Credentials grant type to obtain an access token outside of the context of a user.
Clients typically use this to access resources about themselves rather than a user's resources."
So with this kind of authorization flow, we cannot access users' private resources. See the "Spotify API Authorization types - Docs" link in the External Resources section.
After connecting our OAuth2 node to the "GET Request" nodes via the blue port, opening the configuration of the GET nodes will reveal that the "Credential (input port)" is automatically selected in the "Authentication" tab. Therefore, the Get Request uses the authorization from the OAuth 2 node to make calls.
Here's how the workflow operates:
1. We enter the artist's name to generate the initial URL: https://api.spotify.com/v1/search?q=
2. Then we select an artist from the query list and generate the URL for the second call: https://api.spotify.com/v1/artists/
3. A table view is created showcasing the top ten tracks of the chosen artist.
It's possible to manually change the hardcoded market by accessing the "Query result" component and String manipulation node.
URL: Spotify Client Credentials Flow - Docs https://developer.spotify.com/documentation/web-api/tutorials/client-credentials-flow
URL: How to create a Spotify App - Docs https://developer.spotify.com/documentation/web-api/concepts/apps
URL: Spotify Dashboard https://developer.spotify.com/dashboard
URL: Spotify Web API endpoints - Docs https://developer.spotify.com/documentation/web-api
URL: Spotify List of scopes - Docs https://developer.spotify.com/documentation/web-api/concepts/scopes
URL: Spotify API Authorization types - Docs https://developer.spotify.com/documentation/web-api/concepts/authorization
To use this workflow in KNIME, download it from the below URL and open it in KNIME:
Download WorkflowDeploy, schedule, execute, and monitor your KNIME workflows locally, in the cloud or on-premises – with our brand new NodePit Runner.
Try NodePit Runner!Do you have feedback, questions, comments about NodePit, want to support this platform, or want your own nodes or workflows listed here as well? Do you think, the search results could be improved or something is missing? Then please get in touch! Alternatively, you can send us an email to mail@nodepit.com.
Please note that this is only about NodePit. We do not provide general support for KNIME — please use the KNIME forums instead.