Listings: View Date Genre

This endpoint provides a means of view tracks for a given genre on a given date. The View Genres by Date endpoint leads naturally into this one. Since the genre is passed through the URL of the endpoint call, the genre string must be formatted first. Genres with ampersands (ex. R&B) need to have the ampersand replaced with "_and_" (ex. R&B becomes R_and_B). In addition to the ampersand rule, all spaces must be replaced with an underscore (ex. Top 40 becomes Top_40). This will be shown in more detail in the code examples section of this page.

View Date Genre Specification

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

View Date Genre Workflow

  1. URL: https://api.promoonly.com/genres/[FORMATTED_GENRE]/[DATE (YYYY-MM-DD)]
  2. Header: Authorization: Bearer Base64(userid:token)
  3. Method: GET
  4. Returned: JSON

    Example JSON Output

    [
        {
            "artist": "Khalid x Disclosure",
            "bpm": 103,
            "content_warning": true,
            "downloaded": 0,
            "duration": 180,
            "end": "Cold",
            "explicit": 0,
            "formatid": 67,
            "genre": "Top 40",
            "label": "Right Hand/RCA",
            "media_type": 1,
            "mix": "",
            "modified": 1586428977,
            "release_artist": "Promo Only",
            "release_image": "https://pomed.promoonly.com/issue_imgs/hits_hd_web.jpg",
            "release_ts": 1586404800,
            "releaseid": 56514,
            "title": "Know Your Worth",
            "titleid": 628130,
            "trackid": 374639
        },
        {
            "artist": "Khalid x Disclosure",
            "bpm": 103,
            "content_warning": true,
            "downloaded": 0,
            "duration": 200,
            "end": "Cold",
            "explicit": 0,
            "formatid": 67,
            "genre": "Top 40",
            "label": "Right Hand/RCA",
            "media_type": 1,
            "mix": "PO Intro Edit*",
            "modified": 1586428977,
            "release_artist": "Promo Only",
            "release_image": "https://pomed.promoonly.com/issue_imgs/hits_hd_web.jpg",
            "release_ts": 1586404800,
            "releaseid": 56514,
            "title": "Know Your Worth",
            "titleid": 628137,
            "trackid": 374646
        },
        {
            "artist": "Khalid x Disclosure",
            "bpm": 103,
            "content_warning": true,
            "downloaded": 0,
            "duration": 107,
            "end": "Cold",
            "explicit": 0,
            "formatid": 67,
            "genre": "Top 40",
            "label": "Right Hand/RCA",
            "media_type": 1,
            "mix": "PO Quick Edit*",
            "modified": 1586428977,
            "release_artist": "Promo Only",
            "release_image": "https://pomed.promoonly.com/issue_imgs/hits_hd_web.jpg",
            "release_ts": 1586404800,
            "releaseid": 56514,
            "title": "Know Your Worth",
            "titleid": 628138,
            "trackid": 374647
        }
    ]

Examples

  1. PHP (using cURL):

    <?php
        $userid = 1;
        $token = "8b26e1e4f3f5e00a888807e605565c47";
        $genre = "R&B";
        $formatted_genre = str_replace('&', '_and_', $genre);
        $formatted_genre = str_replace(' ', '_', $formatted_genre);

        $date_genre_url = "https://api.promoonly.com/genres/".$formatted_genre."/2020-04-09";

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $date_genre_url);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer ".base64_encode($userid.":".$token)));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        $date_genre_result = curl_exec($ch);
        curl_close($ch);

        $date_genre_obj = json_decode($date_genre_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);
    var genre = "Top 40";
    var genre_label = genre.replace(/_and_/g, '&').replace(/_/g, ' ');

    $.ajax({
        type: "GET",
        url: "https://api.promoonly.com/genres/" + genre_label + "/2020-04-09",
        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}
    genre = "R&B" genre_label = genre.replace("&", "_and_") genre_label = genre.replace(" ", "_") date_genre_url = "https://api.promoonly.com/genres/%s/2020-04-09" % genre_label
    result_return = requests.get(date_genre_url, headers=headers)

    print(result_return.text)