Preferences: Get User Charts

POOL charts are a valuable part of a user's subscription. It's a quick and easy way to make sure that you have content that is currently popular in national and international charts. However, some charts may not be relevent to every user, this API call will return all charts that a user has access to, and display the status of whether or not they have that chart hidden. This API call will allow for changing what charts are shown or hidden: Save Chart Filters.

Get User Charts Specification

Parameters: Header variables:
  1. userid: integer
  2. token: string
JSON list returned:

Get User Charts Workflow

  1. URL: https://api.promoonly.com/user/charts
  2. Header: Authorization: Bearer Base64(userid:token)
  3. Method: GET
  4. Returned: JSON

    Example JSON Output

    [
        {
            "chart": "Mainstream Top 20",
            "chartid": 24200,
            "format": "POOL Audio Charts",
            "show": 1
        },
        {
            "chart": "Rock Top 20",
            "chartid": 24204,
            "format": "POOL Audio Charts",
            "show": 1
        },
        {
            "chart": "Country Top 20",
            "chartid": 24297,
            "format": "POOL Audio Charts",
            "show": 1
        },
        {
            "chart": "Urban Top 20",
            "chartid": 25109,
            "format": "POOL Audio Charts",
            "show": 1
        },
        {
            "chart": "Nick's Picks",
            "chartid": 24682,
            "format": "POOL Video Charts",
            "show": 1
        }
    ]

Examples

  1. PHP (using cURL):

    <?php
        $userid = 1;
        $token = "8b26e1e4f3f5e00a888807e605565c47";

        $charts_url = "https://api.promoonly.com/user/charts";

        $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);

        $charts_obj = json_decode($charts_result);
    ?>
  2. 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/user/charts",
        headers: { "Authorization": auth_str },
        dataType: "json",
        success: function (data)
        {
            console.log(data);
        }
    });
  3. 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}
    charts_url = "https://api.promoonly.com/user/charts"
    result_return = requests.get(charts_url, headers=headers)

    print(result_return.text)