} if (!$api->checkParameterExists('type', $type)) { $api->output(400, '`Type` value (albums or artists) must be provided in path'); //Type was not provided, return an error return; } require_once $_SERVER['DOCUMENT_ROOT'] . '/server/lib/MusicBrainz.php'; $musicBrainz = new MusicBrainz(); switch ($type) { case 'artist': if (!$api->checkParameterExists('name', $artistName)) { $api->output(400, 'A `name` parameter must be provided in query string for requesting artists'); //Type was not provided, return an error return; } $result = $musicBrainz->searchArtistByName($artistName); if (!$result) { $api->output(400, 'Error: ' . $musicBrainz->errorMessage); //return an error with message return; } $api->output(200, $result); break; case 'album': if (!$api->checkParameterExists('title', $albumTitle)) { $api->output(400, 'A `title` parameter must be provided in query string for requesting albums'); //Type was not provided, return an error return; } $result = $musicBrainz->searchAlbumByTitle($albumTitle); if (!$result) {