API Recipes

Create a User's Playlist

This recipe was an interactive walkthrough in the previous portal. Each step below names the API call it makes; open it in the API Reference to try it.

Step 0: Getting Started

Introduction

Welcome to this API Recipe, where we'll show you how to create a playlist for the current user. This API Recipe will help you navigate through the API endpoints effectively, ensuring you can access the desired information efficiently.

Details

During this walkthrough, we'll be utilizing two key endpoints to achieve our goal:

  1. Get Current User's Profile: This endpoint allows us to retrieve current user's ID. This endpoint required scopes:

    • user-read-email
    • user-read-private
  2. Create Playlist: Once we've identified the desired User's ID, we'll use this endpoint to create a private playlist. This step requires passing the User ID obtained from the previous endpoint. This endpoint required scopes:

    • playlist-modify-private
    • playlist-modify-public.

By following this API Recipe, you'll gain a deeper understanding of how create a playlist for the current user. Let's dive in!

Description

This endpoint allows us to retrieve current user's ID. **This endpoint required scopes \

API call: get-current-users-profile

Step 1: Create Playlist

Description

Once we've identified the desired User's ID, we'll use this endpoint to create a private playlist. This step requires passing the User ID obtained from the previous endpoint. **This endpoint required scopes \

API call: create-playlist

Example arguments:

{
            user_id: userId,
            body:{
              name: 'Test Playlist',
              public: false,
              collaborative: false,
              description: 'This Album was created during the API Recipe execution'
            },
          }

On this page