Given a dataset containing information about students’ test scores, fetch the data from an API, calculate the average score, and create a bar chart to visualize the data.