← Spotify

Get a Playlist's Items with Spotify API

Pipedream makes it easy to connect APIs for Spotify and 900+ other apps remarkably fast.

Trigger workflow on
HTTP requests, schedules and app events
Next, do this
Get a Playlist's Items with the Spotify API
No credit card required
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜
Trusted by 250,000+ developers from startups to Fortune 500 companies:
Trusted by 250,000+ developers from startups to Fortune 500 companies

Developers Pipedream

Getting Started

Create a workflow to Get a Playlist's Items with the Spotify API. When you configure and deploy the workflow, it will run on Pipedream's servers 24x7 for free.

  1. Configure the Get a Playlist's Items action
    1. Connect your Spotify account
    2. Select a Playlist ID
    3. Optional- Configure Fields
    4. Optional- Configure Limit
    5. Optional- Configure Offset
    6. Optional- Select one or more Additional Types
  2. Select a trigger to run your workflow on HTTP requests, schedules or app events
  3. Deploy the workflow
  4. Send a test event to validate your setup
  5. Turn on the trigger

Integrations

Get a Playlist's Items with Spotify API on New Requests (Payload Only) from HTTP / Webhook API
HTTP / Webhook + Spotify
 
Try it
Get a Playlist's Items with Spotify API on New Item in Feed from RSS API
RSS + Spotify
 
Try it
Get a Playlist's Items with Spotify API on New Message from Discord API
Discord + Spotify
 
Try it
Get a Playlist's Items with Spotify API on New Message In Channels from Slack API
Slack + Spotify
 
Try it
Get a Playlist's Items with Spotify API on New Message in Channel from Discord Bot API
Discord Bot + Spotify
 
Try it

Details

This is a pre-built, open source component from Pipedream's GitHub repo. The component is developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.

Get a Playlist's Items on Spotify
Description:Get full details of the items of a playlist owned by a Spotify user. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-playlists-tracks).
Version:0.0.3
Key:spotify-get-playlist-items

Code

import { axios } from "@pipedream/platform";
import get from "lodash/get.js";
import spotify from "../../spotify.app.mjs";

export default {
  name: "Get a Playlist's Items",
  description: "Get full details of the items of a playlist owned by a Spotify user. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-playlists-tracks).",
  key: "spotify-get-playlist-items",
  version: "0.0.3",
  type: "action",
  props: {
    spotify,
    playlistId: {
      propDefinition: [
        spotify,
        "playlistId",
      ],
    },
    fields: {
      type: "string",
      label: "Fields",
      description: "Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are returned. For example, to get just the total number of items and the request limit: `total,limit`. [See the docs](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-playlists-tracks) for more information.",
      optional: true,
    },
    limit: {
      propDefinition: [
        spotify,
        "limit",
      ],
    },
    offset: {
      propDefinition: [
        spotify,
        "offset",
      ],
    },
    additionalTypes: {
      type: "string[]",
      label: "Additional Types",
      description: "A comma-separated list of item types that your client supports besides the default `track` type. Valid types are: `track` and `episode`. **Note**: This parameter was introduced to allow existing clients to maintain their current behaviour and might be deprecated in the future. In addition to providing this parameter, make sure that your client properly handles cases of new types in the future by checking against the `type` field of each object.",
      optional: true,
      options: [
        "Track",
        "Episode",
      ],
    },
  },
  async run({ $ }) {
    const {
      playlistId,
      market,
      fields,
      limit,
      offset,
      additionalTypes,
    } = this;

    const res = await axios($, this.spotify._getAxiosParams({
      method: "GET",
      path: `/playlists/${get(playlistId, "value", playlistId)}/tracks`,
      params: {
        fields,
        market,
        limit,
        offset,
        additional_types: additionalTypes && additionalTypes.join(",").toLowerCase(),
      },
    }));

    $.export("$summary", `Successfully fetched details for "${get(playlistId, "label", playlistId)}"`);

    return get(res, "items", []);
  },
};

Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
LabelPropTypeDescription
SpotifyspotifyappThis component uses the Spotify app.
Playlist IDplaylistIdstringSelect a value from the drop down menu.
Fieldsfieldsstring

Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are returned. For example, to get just the total number of items and the request limit: total,limit. See the docs for more information.

Limitlimitinteger

The maximum number of items to return. The default is 100.

Offsetoffsetinteger

The index of the first item to return. Default: 0 (the first object). Use with limit to get the next set of items.

Additional TypesadditionalTypesstring[]Select a value from the drop down menu:TrackEpisode

Authentication

Spotify uses OAuth authentication. When you connect your Spotify account, Pipedream will open a popup window where you can sign into Spotify and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Spotify API.

Pipedream requests the following authorization scopes when you connect your account:

playlist-read-collaborativeplaylist-modify-privateplaylist-modify-publicplaylist-read-privateuser-modify-playback-stateuser-read-currently-playinguser-read-playback-stateuser-read-privateuser-read-emailuser-library-modifyuser-library-readuser-follow-modifyuser-follow-readuser-read-recently-playeduser-top-readstreamingapp-remote-controlugc-image-uploaduser-read-playback-position

About Spotify

Music streaming

More Ways to Use Spotify

Triggers

New Playlist from the Spotify API

Emit new event when a new playlist is created or followed by the current Spotify user.

 
Try it
New Saved Track from the Spotify API

Emit new event for each new track saved to the current Spotify user's Music Library.

 
Try it
New Track in Playlist from the Spotify API

Emit new event for each new Spotify track added to a playlist

 
Try it

Actions

Add Items to a Playlist with the Spotify API

Add one or more items to a user’s playlist. See the docs here.

 
Try it
Create a Playlist with the Spotify API

Create a playlist for a Spotify user. The playlist will be empty until you add tracks. See the docs here.

 
Try it
Get a Category's Playlists with the Spotify API

Get a list of Spotify playlists tagged with a particular category. See the docs here.

 
Try it
Get a Track with the Spotify API

Get a track by its name or ID. See the docs here

 
Try it
Get an Artist's Top Tracks with the Spotify API

Get Spotify catalog information about an artist’s top tracks by country. See the docs here.

 
Try it