This is a Card
Interesting content you want to highlight.
This is a description of the page
To get started with Spotted and the Spotify Web API, follow these steps:
This is a Card
Interesting content you want to highlight.
Another Card
Another interesting content you want to highlight.
Console.WriteLine('Hello, world!');Import the component into your MDX file:
import { Steps } from "@astrojs/starlight/components";Wrap <Steps> around your ordered list items.
Some stars:
Bellatrix, Rigel, Betelgeuse
Pollux, Castor A, Castor B
Some exoplanets:
HD 34445 b, Gliese 179 b, Wasp-82 b
Pollux b, HAT-P-24b, HD 50554 b
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
Most SDKs require you to exchange your client credentials for an access token. Here’s an example in Node.js using node-fetch:
const fetch = require("node-fetch");const client_id = "YOUR_CLIENT_ID"; // Replace with your Client IDconst client_secret = "YOUR_CLIENT_SECRET"; // Replace with your Client Secret
async function getAccessToken() { const response = await fetch("https://accounts.spotify.com/api/token", { method: "POST", headers: { Authorization: "Basic " + Buffer.from(client_id + ":" + client_secret).toString("base64"), "Content-Type": "application/x-www-form-urlencoded", }, body: "grant_type=client_credentials", });
const data = await response.json(); return data.access_token;}Once you have an access token, you can query the API. Here’s how to list new album releases:
async function listNewReleases() { const token = await getAccessToken();
const response = await fetch( "https://api.spotify.com/v1/browse/new-releases", { headers: { Authorization: `Bearer ${token}`, }, }, );
const data = await response.json(); console.log(data.albums.items.map((album) => album.name));}
listNewReleases();That’s it! You’ve authenticated and fetched a list of new albums from Spotify using the Spotted API. For more advanced usage, check the rest of the documentation or explore the available SDKs!