Music
This document describes the available music endpoints and their features.
List Music
Retrieve a list of all available music tracks.
Endpoint
- Method: GET
- URL:
/api/musics
Request Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
| Accept | application/json | Yes |
| Authorization | Bearer YOUR_API_TOKEN | Yes |
Success Response
{
"success": true,
"message": "Data retrieved successfully",
"data": [
{
"id": 1,
"title": "Relaxing Melody",
"sub_title": "Calming Sounds",
"description": "A peaceful melody to help you relax",
"file": "/storage/music/relaxing.mp3",
"file_extension": "mp3",
"is_vip": true,
"can_access": true
}
]
}
Response Fields
| Field | Type | Description |
|---|---|---|
| id | integer | Unique identifier for the music track |
| title | string | Title of the music track (localized based on Accept-Language) |
| sub_title | string | Subtitle of the music track (localized based on Accept-Language) |
| description | string | Description of the music track (localized based on Accept-Language) |
| file | string | URL to the music file |
| file_extension | string | File extension of the music file (e.g., mp3, wav) |
| is_vip | boolean | Whether this track is for VIP users only |
| can_access | boolean | Whether the current user can access this track |
Implementation Notes
- Music tracks are ordered by
order_numberin ascending order - The
can_accessfield is calculated based on:- Track's VIP status (
is_vip) - User's VIP subscription status
- Non-VIP tracks are accessible to all users
- VIP tracks are only accessible to users with active VIP subscriptions
- Track's VIP status (
- File URLs are generated using Laravel's Storage facade
- Responses are localized based on the Accept-Language header