Overview
The search endpoint allows you to query the MYMUSICK backend for songs. It returns an array of song objects matching your search query.Endpoint
Query Parameters
The search query string. This can be a song title, artist name, or any combination of keywords.
Request Examples
Response
Returns an array of song objects. See Response Format for detailed schema documentation.Success Response (200 OK)
Empty Results
If no songs match the query, the API returns an empty array:Error Response
If the request fails, check the HTTP status code for error details.Implementation Notes
Always use
encodeURIComponent() when building the query parameter to properly handle special characters and spaces.Usage in MYMUSICK
From the main application code (index.html:113-134):Best Practices
- Validation: Always validate and trim user input before making requests
- Encoding: Use
encodeURIComponent()to properly encode query parameters - Error Handling: Implement try-catch blocks to gracefully handle network errors
- User Feedback: Display loading states while waiting for responses
- Empty States: Handle empty result arrays appropriately in your UI
