Soundtrack API
Soundtrack est une plateforme de streaming musical conçue pour les entreprises. L'API Soundtrack te permet de créer des applications qui affichent, contrôlent et surveillent la musique diffusée dans tes sites. En savoir plus sur Soundtrack et obtenir des idées pour utiliser l'API.
Ce guide couvre la façon d'appeler l'API Soundtrack : authentification, requêtes, interrogations, abonnements, mutations, erreurs et limites de débit. Nouveau sur l'API ? Commence par Ta première requête. Tu connais déjà le fonctionnement ? Rends-toi sur l' explorateur d'API ou la référence de l'API.
Des questions ou des suggestions ? Envoie-nous un message sur notre canal Slack public.
Your first query
curl -XPOST https://api.soundtrack.io/v2 \
-H 'Authorization: Basic your_token' \
-H 'Content-Type: application/json' \
-d '{
"query": "query NowPlaying($soundZone: ID!) { nowPlaying(soundZone: $soundZone) { track { title artists { name } } } }",
"variables": {"soundZone": "sound_zone_id"},
"operationName": "NowPlaying"
}'Response
{
"data": {
"nowPlaying": {
"track": {
"title": "Branches",
"artists": [
{
"name": "Fluida"
}
]
}
}
}
}The Soundtrack API is a GraphQL API, so each request names the fields it wants and the response contains exactly those. This query asks what's playing in a zone, for example to show it on a screen in your store: the track's title and the names of its artists.
The zone's ID goes in variables: replace sound_zone_id with the ID of one of your zones. Figuring out what you don't know shows how to find it.
There's a lot more you can fetch and control. The guide continues on these pages:
- The basics: the endpoint, tokens and what a request is made of
- Queries and mutations: reading data and making changes
- Subscriptions: updates as they happen, over a WebSocket
- Errors and rate limits: what can go wrong, the rate limit, and when to retry
- Advanced usage: GraphQL clients, pagination, variables and fragments
To look up a type, query or mutation, browse the API reference.
Explore
To try the API, use the API explorer. To read the schema without signing in, use the API reference.
Add your Authorization header and the API explorer lets you write and run queries, with documentation and autocompletion.
Queries in the API explorer use live data and count toward your rate limit.
Terms of use
Read and comply with our API Terms of Use
By using the Soundtrack API, you accept our API Terms of Use. Make it clear to the people using your application that you built and maintain it. Using Soundtrack marketing material, other than artwork provided through the API, needs Soundtrack's written consent. For example, you can't use graphics from our products, such as buttons, to create a similar experience.
Licensing restrictions currently don't allow visitors to control playback. For example, you can build an application where your authorized staff change the music playing in a zone, but you can't offer the same controls to your visitors. Showing what's playing, such as the track name or URL, is fine, since that counts as non-interactive.