Once a list of charts has been retrieved, you can pull a Chart ID to view. This API call will allow you to see information for all of the tracks associated with a given chart. Charts are setup as a release behind the scenes, so the API call for pulling chart information is identical to that of viewing Releases.
Example JSON Output:
{
"date": "2020-04-01",
"formatid": 89,
"id": 24200,
"label_img": "https://loop.promoonly.com/assets/po_small.png",
"mod_time": 1585760932,
"month": 0,
"release": "Mainstream Top 20",
"release_artist": "Promo Only",
"release_genre": "Compilation",
"release_img": "http://pomed.promoonly.com/issue_imgs/24200_chart.jpg",
"release_label": "Promo Only Issue",
"year": 0,
"tracks":
[
{
"artist": "Dua Lipa",
"bpm": 124,
"content_warning": false,
"downloaded": 0,
"duration": 203,
"end": "Cold",
"explicit": 0,
"genre": "Pop",
"label": "Warner",
"media_type": 2,
"mix": "PopRoXxX Intro Edit",
"order": 1,
"title": "Don't Start Now",
"titleid": 617020,
"trackid": 357364
},
{
"artist": "Harry Styles",
"bpm": 99,
"content_warning": false,
"downloaded": 0,
"duration": 206,
"end": "Cold",
"explicit": 0,
"genre": "Pop",
"label": "Erskine/Columbia",
"media_type": 2,
"mix": "",
"order": 2,
"title": "Adore You",
"titleid": 618501,
"trackid": 359383
},
{
"artist": "blackbear",
"bpm": 65,
"content_warning": true,
"downloaded": 0,
"duration": 270,
"end": "Cold",
"explicit": 0,
"genre": "Hip-Hop",
"label": "Beartrap/Alamo/Interscope",
"media_type": 2,
"mix": "PO Intro Edit",
"order": 3,
"title": "Hot Girl Bummer",
"titleid": 615258,
"trackid": 359381
}
]
}
PHP (using cURL):
<?php
$userid = 1;
$token = "8b26e1e4f3f5e00a888807e605565c47";
$chart_url = "https://api.promoonly.com/release/24200";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $charts_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer ".base64_encode($userid.":".$token)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$charts_result = curl_exec($ch);
curl_close($ch);
$sync_obj = json_decode($charts_result);
?>
Javascript (using jQuery):
function b64EncodeUnicode(str)
{
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,
function toSolidBytes(match, p1)
{
return String.fromCharCode('0x' + p1);
}));
}
var userid = 1;
var token = "8b26e1e4f3f5e00a888807e605565c47";
var auth_str = "Bearer " + b64EncodeUnicode(userid + ":" + token);
$.ajax({
type: "GET",
url: "https://api.promoonly.com/release/24200",
headers: { "Authorization": auth_str },
dataType: "json",
success: function (data)
{
console.log(data);
}
});
Python (using requests):
#!/usr/bin/env python
import requests
import base64
import urllib
userid = 1
token = "8b26e1e4f3f5e00a888807e605565c47"
b64_key = base64.b64encode("%s:%s" % (userid, token))
headers = {"Authorization": "Bearer %s" % b64_key}
chart_url = "https://api.promoonly.com/release/24200"
result_return = requests.get(chart_url, headers=headers)
print(result_return.text)