To authenticate with the API, HTTP requests should include an API key in the Authorization
HTTP header. The API key
should be prefixed with the word "Token", as shown:
Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b
Here's a complete example of a request to the API using authentication:
curl -H "Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b" https://api.radiomast.io/v1/radiostreams/radiomast/ { "count": 1, "next": null, "previous": null, "results": [ { "audio_parameters": { "bitrate": 128, "channels": 2, "codec": "MP3", "samplerate": 44100 }, "listening_url": "https://streams.radiomast.io/714f37d7-4110-49dd-b0eb-17c75790d54d", "monitoring": { "enabled": false, "last_tested_at": null, "plan": null, "silence_detection": false, "silence_duration": 15, "silence_threshold_db": -60, "status": "Pending", "uptime_24_hours": "N/A", "uptime_30_days": "N/A", "uptime_7_days": "N/A" }, "mount": "714f37d7-4110-49dd-b0eb-17c75790d54d", "name": "High Quality Stream", "password": "<removed>", "station": "9066b4fc-1cc2-4475-a365-613ea79107a7", "streaming_plan": "100L-192", "username": "source", "listener_count": 5, "uuid": "714f37d7-4110-49dd-b0eb-17c75790d54d" } }
import requests import pprint resp = requests.get("https://api.radiomast.io/v1/radiostreams/radiomast/", headers={'Authorization': "Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b"}) pprint.pprint(resp.json()) {u'count': 10, u'next': None, u'previous': None, u'results': [{u'audio_parameters': {u'bitrate': 128, u'channels': 2, u'codec': u'MP3', u'samplerate': 44100}, u'listening_url': u'https://streams.radiomast.io/714f37d7-4110-49dd-b0eb-17c75790d54d', u'monitoring': {u'enabled': False, u'last_tested_at': None, u'plan': None, u'silence_detection': False, u'silence_duration': 15, u'silence_threshold_db': -60, u'status': u'Pending', u'uptime_24_hours': u'N/A', u'uptime_30_days': u'N/A', u'uptime_7_days': u'N/A'}, u'mount': u'714f37d7-4110-49dd-b0eb-17c75790d54d', u'name': u'Second Hosted Stream', u'password': u'<removed>>', u'station': u'9066b4fc-1cc2-4475-a365-613ea79107a7', u'streaming_plan': u'100L-192', u'username': u'source', u'listener_count': 5, u'uuid': u'714f37d7-4110-49dd-b0eb-17c75790d54d'}, }