DownloadController Documentation

The DownloadController provides several API endpoints that allow users to download tracks, and track/album/artist/playlist/collection artwork. The controller supports both direct downloads and transcoding to mp3 on the fly. When downloading artwork, if the linked object isn't found or artwork isn't found for it, the default artwork is sent. See Artwork Architecture for more info.

Controller Route: /api/download

All routes within the DownloadController are prefixed by /api/download/ and are primarily used for downloading media-related content such as tracks and artwork.


Summary of Endpoints

Endpoint Method Description Authorization
/api/download/track GET Download a track file based on its ID. Admin, User
/api/download/track-transcode GET Download a transcoded version of a track. Admin, User
/api/download/track-wave GET Get the waveform of a track in a specified width. Admin, User
/api/download/track-art GET Download the artwork associated with a specific track. Admin, User
/api/download/album-art GET Download the artwork associated with a specific album. Admin, User
/api/download/artist-pfp GET Download the profile picture of an artist. Admin, User
/api/download/artist-banner GET Download the banner artwork of an artist. Admin, User
/api/download/playlist-art GET Download the artwork of a specific playlist. Admin, User
/api/download/collection-art GET Download the artwork associated with a specific collection. Admin, User

Download Track

This endpoint allows users to download a track based on its ID. Downloading supports range requests for partial content streaming or resuming interrupted downloads.

Details:

Parameters:

Responses:

Example Request (using curl):

curl -X GET "https://your-melon-server.com/api/download/track?id=66bc9aadab7ba419497e6a97" \
             -H "Authorization: Bearer <User-JWT>"
        

Example Request with range (using curl):

curl -X GET "https://your-melon-server.com/api/download/track?id=66bc9aadab7ba419497e6a97" \
             -H "Authorization: Bearer <User-JWT>" \
             -H "Range: bytes=1000-"
        

Download Track with Transcoding

This endpoint allows users to download an mp3 transcoded version of a track in a specific bitrate.

Details:

Parameters:

Responses:

Example Request (using curl):

curl -X GET "https://your-melon-server.com/api/download/track-transcode?id=66bc9aadab7ba419497e6a97&transcodeBitrate=320" \
             -H "Authorization: Bearer <User-JWT>"
        

Download Track Waveform

This endpoint allows users to generate and download a visual representation of the track's waveform with a specified width. Waveform is represented as float points of amplitude.

Details:

Parameters:

Responses:

Example Request (using curl):

curl -X GET "https://your-melon-server.com/api/download/track-wave?id=66bc9aadab7ba419497e6a97&width=500" \
             -H "Authorization: Bearer <User-JWT>"
        

Download Track Artwork

This endpoint allows users to download the artwork embedded within a track.

Details:

Parameters:

Responses:

Example Request (using curl):

curl -X GET "https://your-melon-server.com/api/download/track-art?id=66bc9aadab7ba419497e6a97" \
             -H "Authorization: Bearer <User-JWT>"
        

Download Album Artwork

This endpoint allows users to download the artwork associated with a specific album. See Artwork Architecture for more info on how album art is handled.

Details:

Parameters:

Responses:

Example Request (using curl):

curl -X GET "https://your-melon-server.com/api/download/album-art?id=album123" \
             -H "Authorization: Bearer <User-JWT>"
        

Download Artist Profile Picture

This endpoint allows users to download the profile picture of an artist.

Details:

Parameters:

Responses:

Example Request (using curl):

curl -X GET "https://your-melon-server.com/api/download/artist-pfp?id=artist123" \
             -H "Authorization: Bearer <User-JWT>"
        

Download Artist Banner

This endpoint allows users to download the banner artwork of an artist.

Details:

Parameters:

Responses:

Example Request (using curl):

curl -X GET "https://your-melon-server.com/api/download/artist-banner?id=artist123" \
             -H "Authorization: Bearer <User-JWT>"
        

Download Playlist Artwork

This endpoint allows users to download the artwork associated with a specific playlist.

Details:

Parameters:

Responses:

Example Request (using curl):

curl -X GET "https://your-melon-server.com/api/download/playlist-art?id=playlist123" \
             -H "Authorization: Bearer <User-JWT>"
        

Download Collection Artwork

This endpoint allows users to download the artwork associated with a specific collection.

Details:

Parameters:

Responses:

Example Request (using curl):

curl -X GET "https://your-melon-server.com/api/download/collection-art?id=collection123" \
             -H "Authorization: Bearer <User-JWT>"