GET /comments

Retrieves comments for a specific artist based on the query parameter artist.

Endpoint URL

http://127.0.0.1:8080/comments?artist=artistName

Query Parameters

Name
Type
Description

artist

string

The name of the artist to retrieve comments for.

Example code

async function makeComment (artistName) {
    try {
        const response = await fetch(`http://127.0.0.1:8080/comments?artist=${artistName}`);
        const comments = await response.json();
        // Proceed with using the comments held in comments
        
    } catch (error) {
        alert(error);
    }
};

Example Response

// Returning array of comments for Don Toliver 
["Still remember him from Can't Say","He's amazing","the don"]

Response Code

  • 200 OK : Returns an array of comments for a specified artist

Response Fields

Name
Type
Description

comments

array

All the comments that was written about the specified artist. (NB : Name here is based on the name for the response sent back to the client.)

Last updated