Audioburst Web API V2

3.7 Get User Preferences

Get User Preferences

Try it

Request URL

Request parameters

string

Unique userId, see Register User API.

(optional)
string

Either city or lat,long location of the user to allow localized content like news, weather and traffic.

Request headers

string
Subscription key which provides access to this API. Found in your Profile.

Request body

Response 200

Example

{
  "id": "2ee9cc00-1234-5678-abcd-1234abcd5678ef",
  "userId": "8765432a-9876-4qaz-89da-cbcd99f123b1",
  "appKey": "1dc65c9a87654a98a412345f6c654321",
  "location": null,
  "sourceType": "mix",
  "preferences": [
    {
      "name": "Trending and Popular",
      "source": "trending",
      "take": 6,
      "offer": 6,
      "keys": [
        {
          "key": "World Wildlife Fund",
          "segCategory": "NA",
          "source": "trending",
          "sourceId": 0,
          "position": 1,
          "selected": false
        },
        {
          "key": "Andrew Gillum",
          "segCategory": "NA",
          "source": "trending",
          "sourceId": 0,
          "position": 1,
          "selected": false
        },
        {
          "key": "Julian Assange",
          "segCategory": "NA",
          "source": "trending",
          "sourceId": 0,
          "position": 2,
          "selected": false
        },
        {
          "key": "Laura Ingraham",
          "segCategory": "NA",
          "source": "trending",
          "sourceId": 0,
          "position": 2,
          "selected": false
        },
        {
          "key": "Gregory Bush",
          "segCategory": "NA",
          "source": "trending",
          "sourceId": 0,
          "position": 3,
          "selected": false
        },
        {
          "key": "Robert Gregory Bowers",
          "segCategory": "NA",
          "source": "trending",
          "sourceId": 0,
          "position": 3,
          "selected": false
        }
      ]
    },
    {
      "name": "News",
      "source": "combined",
      "take": 2,
      "offer": 6,
      "keys": [
        {
          "key": "Burst of the Day",
          "segCategory": "news.bod",
          "source": "bod",
          "sourceId": 0,
          "position": 1,
          "selected": true
        },
        {
          "key": "National News",
          "segCategory": "news.us",
          "source": "playlist",
          "sourceId": 4,
          "position": 999,
          "selected": true
        },
        {
          "key": "Politics",
          "segCategory": "news.us.politics",
          "source": "playlist",
          "sourceId": 4,
          "position": 2,
          "selected": false
        },
        {
          "key": "World News",
          "segCategory": "news.foreign",
          "source": "playlist",
          "sourceId": 6,
          "position": 3,
          "selected": false
        }
      ]
    },
    {
      "name": "Sports",
      "source": "combined",
      "take": 2,
      "offer": 13,
      "keys": [
        {
          "key": "Sports News",
          "segCategory": "news.sports",
          "source": "playlist",
          "sourceId": 10,
          "position": 999,
          "selected": false
        },
        {
          "key": "NBA Basketball",
          "segCategory": "sports.nba",
          "source": "playlist",
          "sourceId": 10,
          "position": 1,
          "selected": true
        },
        {
          "key": "NFL Football",
          "segCategory": "sports.nfl",
          "source": "playlist",
          "sourceId": 10,
          "position": 1,
          "selected": false
        },
        {
          "key": "MLB Baseball",
          "segCategory": "sports.mlb",
          "source": "playlist",
          "sourceId": 10,
          "position": 2,
          "selected": true
        },
        {
          "key": "NHL Hockey",
          "segCategory": "sports.nhl",
          "source": "playlist",
          "sourceId": 10,
          "position": 2,
          "selected": false
        },
        {
          "key": "NCAA",
          "segCategory": "sports.ncaa",
          "source": "playlist",
          "sourceId": 10,
          "position": 2,
          "selected": false
        },
        {
          "key": "FIFA",
          "segCategory": "sports.fifa",
          "source": "playlist",
          "sourceId": 10,
          "position": 2,
          "selected": false
        },
        {
          "key": "NASCAR Racing",
          "segCategory": "sports.nascar",
          "source": "playlist",
          "sourceId": 10,
          "position": 2,
          "selected": false
        },
        {
          "key": "Tennis",
          "segCategory": "sports.tennis",
          "source": "playlist",
          "sourceId": 10,
          "position": 2,
          "selected": false
        },
        {
          "key": "Wrestling and MMA",
          "segCategory": "sports.wrestling",
          "source": "playlist",
          "sourceId": 10,
          "position": 3,
          "selected": false
        },
        {
          "key": "Boxing",
          "segCategory": "sports.boxing",
          "source": "playlist",
          "sourceId": 10,
          "position": 3,
          "selected": false
        },
        {
          "key": "PGA Tour Golf",
          "segCategory": "sports.golf",
          "source": "playlist",
          "sourceId": 10,
          "position": 3,
          "selected": false
        },
        {
          "key": "WNBA Basketball",
          "segCategory": "sports.wnba",
          "source": "playlist",
          "sourceId": 10,
          "position": 3,
          "selected": false
        }
      ]
    },
    {
      "name": "Entertainment",
      "source": "combined",
      "take": 2,
      "offer": 1,
      "keys": [
        {
          "key": "Entertainment",
          "segCategory": "news.entertainment",
          "source": "playlist",
          "sourceId": 9,
          "position": 999,
          "selected": true
        },
        {
          "key": "TV and Movies",
          "segCategory": "news.entertainment",
          "source": "podcast",
          "sourceId": 157,
          "position": 1,
          "selected": false
        },
        {
          "key": "Music",
          "segCategory": "news.entertainment",
          "source": "podcast",
          "sourceId": 158,
          "position": 3,
          "selected": false
        },
        {
          "key": "Celebs",
          "segCategory": "news.entertainment",
          "source": "podcast",
          "sourceId": 159,
          "position": 2,
          "selected": false
        }
      ]
    },
    {
      "name": "Business",
      "source": "combined",
      "take": 2,
      "offer": 6,
      "keys": [
        {
          "key": "Business News",
          "segCategory": "news.finance",
          "source": "playlist",
          "sourceId": 3,
          "position": 1,
          "selected": false
        },
        {
          "key": "Real Estate",
          "segCategory": "business.personalFinance",
          "source": "podcast",
          "sourceId": 155,
          "position": 3,
          "selected": false
        },
        {
          "key": "Entrepreneurs",
          "segCategory": "business.smallMediumBusiness",
          "source": "podcast",
          "sourceId": 156,
          "position": 3,
          "selected": false
        },
        {
          "key": "Careers",
          "segCategory": "business.smallMediumBusiness",
          "source": "podcast",
          "sourceId": 197,
          "position": 1,
          "selected": false
        },
        {
          "key": "Consumer Protection",
          "segCategory": "business.consumerProtection",
          "source": "podcast",
          "sourceId": 198,
          "position": 3,
          "selected": false
        },
        {
          "key": "Financial Advice",
          "segCategory": "business.consumerProtection",
          "source": "podcast",
          "sourceId": 154,
          "position": 2,
          "selected": false
        }
      ]
    },
    {
      "name": "Tech",
      "source": "combined",
      "take": 2,
      "offer": 4,
      "keys": [
        {
          "key": "Tech News",
          "segCategory": "news.tech",
          "source": "playlist",
          "sourceId": 5,
          "position": 1,
          "selected": false
        },
        {
          "key": "Tech Advice",
          "segCategory": "tech.advice",
          "source": "podcast",
          "sourceId": 164,
          "position": 3,
          "selected": false
        },
        {
          "key": "Computer Science",
          "segCategory": "tech.pro",
          "source": "podcast",
          "sourceId": 165,
          "position": 2,
          "selected": false
        },
        {
          "key": "Gaming",
          "segCategory": "tech.gaming",
          "source": "podcast",
          "sourceId": 166,
          "position": 1,
          "selected": false
        }
      ]
    },
    {
      "name": "Kids",
      "source": "feed",
      "take": 1,
      "offer": 2,
      "keys": [
        {
          "key": "Facts",
          "segCategory": "kids",
          "source": "feed",
          "sourceId": 55,
          "position": 2,
          "selected": false
        }
      ]
    },
    {
      "name": "Lifestyle",
      "source": "combined",
      "take": 2,
      "offer": 7,
      "keys": [
        {
          "key": "Fashion",
          "segCategory": "lifestyle.fashionAndBeauty",
          "source": "podcast",
          "sourceId": 167,
          "position": 2,
          "selected": false
        },
        {
          "key": "Food and Dining",
          "segCategory": "lifestyle.food",
          "source": "podcast",
          "sourceId": 168,
          "position": 1,
          "selected": false
        },
        {
          "key": "Pets",
          "segCategory": "lifestyle.pets.general",
          "source": "podcast",
          "sourceId": 169,
          "position": 3,
          "selected": false
        },
        {
          "key": "DIY",
          "segCategory": "lifestyle.diy",
          "source": "podcast",
          "sourceId": 170,
          "position": 2,
          "selected": false
        },
        {
          "key": "Travel",
          "segCategory": "lifestyle.travel",
          "source": "podcast",
          "sourceId": 171,
          "position": 1,
          "selected": false
        },
        {
          "key": "Outdoors",
          "segCategory": "lifestyle.outdoors",
          "source": "podcast",
          "sourceId": 172,
          "position": 2,
          "selected": false
        },
        {
          "key": "Cars",
          "segCategory": "lifestyle.cars",
          "source": "podcast",
          "sourceId": 196,
          "position": 2,
          "selected": false
        }
      ]
    },
    {
      "name": "Health and Science",
      "source": "combined",
      "take": 2,
      "offer": 3,
      "keys": [
        {
          "key": "Health",
          "segCategory": "scienceAndHealth",
          "source": "playlist",
          "sourceId": 8,
          "position": 1,
          "selected": false
        },
        {
          "key": "Science",
          "segCategory": "scienceAndHealth",
          "source": "podcast",
          "sourceId": 192,
          "position": 3,
          "selected": false
        }
      ]
    },
    {
      "name": "Relationships",
      "source": "combined",
      "take": 1,
      "offer": 2,
      "keys": [
        {
          "key": "Dating and Marriage",
          "segCategory": "lifestyle.familyAndRelationship",
          "source": "podcast",
          "sourceId": 190,
          "position": 3,
          "selected": false
        },
        {
          "key": "Parenting",
          "segCategory": "lifestyle.familyAndRelationship",
          "source": "podcast",
          "sourceId": 191,
          "position": 1,
          "selected": false
        }
      ]
    },
    {
      "name": "Culture",
      "source": "combined",
      "take": 2,
      "offer": 3,
      "keys": [
        {
          "key": "Arts",
          "segCategory": "culture.artsAndDesign",
          "source": "podcast",
          "sourceId": 160,
          "position": 3,
          "selected": false
        },
        {
          "key": "Books",
          "segCategory": "culture.books",
          "source": "podcast",
          "sourceId": 161,
          "position": 2,
          "selected": false
        },
        {
          "key": "Design",
          "segCategory": "culture.artsAndDesign",
          "source": "podcast",
          "sourceId": 162,
          "position": 3,
          "selected": false
        }
      ]
    },
    {
      "name": "Education",
      "source": "combined",
      "take": 2,
      "offer": 2,
      "keys": [
        {
          "key": "History",
          "segCategory": "culture.history",
          "source": "podcast",
          "sourceId": 183,
          "position": 2,
          "selected": false
        },
        {
          "key": "Law",
          "segCategory": "law",
          "source": "podcast",
          "sourceId": 185,
          "position": 3,
          "selected": false
        }
      ]
    },
    {
      "name": "Comedy",
      "source": "combined",
      "take": 2,
      "offer": 1,
      "keys": [
        {
          "key": "Comedy",
          "segCategory": "humor",
          "source": "podcast",
          "sourceId": 187,
          "position": 1,
          "selected": false
        }
      ]
    },
    {
      "name": "Documentary",
      "source": "combined",
      "take": 1,
      "offer": 1,
      "keys": [
        {
          "key": "Documentary",
          "segCategory": "culture.documentary",
          "source": "podcast",
          "sourceId": 188,
          "position": 1,
          "selected": false
        }
      ]
    },
    {
      "name": "Paranormal",
      "source": "combined",
      "take": 1,
      "offer": 1,
      "keys": [
        {
          "key": "Paranormal",
          "segCategory": "Paranormal",
          "source": "podcast",
          "sourceId": 189,
          "position": 3,
          "selected": false
        }
      ]
    },
    {
      "name": "Sustainability",
      "source": "combined",
      "take": 1,
      "offer": 1,
      "keys": [
        {
          "key": "Sustainability",
          "segCategory": "lifestyle.sustainability",
          "source": "podcast",
          "sourceId": 200,
          "position": 3,
          "selected": false
        }
      ]
    },
    {
      "name": "Offbeat",
      "source": "combined",
      "take": 1,
      "offer": 1,
      "keys": [
        {
          "key": "Offbeat",
          "segCategory": "offbeat",
          "source": "playlist",
          "sourceId": 90,
          "position": 2,
          "selected": false
        }
      ]
    }
  ]
}

Code samples

@ECHO OFF

curl -v -X GET "https://developersapi.audioburst.com/v2/user/preferences?userId={userId}?location={string}"
-H "Ocp-Apim-Subscription-Key: {subscription key}"

--data-ascii "{body}" 
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;

namespace CSHttpClientSample
{
    static class Program
    {
        static void Main()
        {
            MakeRequest();
            Console.WriteLine("Hit ENTER to exit...");
            Console.ReadLine();
        }
        
        static async void MakeRequest()
        {
            var client = new HttpClient();
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            // Request headers
            client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "{subscription key}");

            // Request parameters
            queryString["location"] = "{string}";
            var uri = "https://developersapi.audioburst.com/v2/user/preferences?userId={userId}&" + queryString;

            var response = await client.GetAsync(uri);
        }
    }
}	
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class JavaSample 
{
    public static void main(String[] args) 
    {
        HttpClient httpclient = HttpClients.createDefault();

        try
        {
            URIBuilder builder = new URIBuilder("https://developersapi.audioburst.com/v2/user/preferences?userId={userId}");

            builder.setParameter("location", "{string}");

            URI uri = builder.build();
            HttpGet request = new HttpGet(uri);
            request.setHeader("Ocp-Apim-Subscription-Key", "{subscription key}");


            // Request body
            StringEntity reqEntity = new StringEntity("{body}");
            request.setEntity(reqEntity);

            HttpResponse response = httpclient.execute(request);
            HttpEntity entity = response.getEntity();

            if (entity != null) 
            {
                System.out.println(EntityUtils.toString(entity));
            }
        }
        catch (Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
}

<!DOCTYPE html>
<html>
<head>
    <title>JSSample</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>

<script type="text/javascript">
    $(function() {
        var params = {
            // Request parameters
            "location": "{string}",
        };
      
        $.ajax({
            url: "https://developersapi.audioburst.com/v2/user/preferences?userId={userId}&" + $.param(params),
            beforeSend: function(xhrObj){
                // Request headers
                xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","{subscription key}");
            },
            type: "GET",
            // Request body
            data: "{body}",
        })
        .done(function(data) {
            alert("success");
        })
        .fail(function() {
            alert("error");
        });
    });
</script>
</body>
</html>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
    NSString* path = @"https://developersapi.audioburst.com/v2/user/preferences?userId={userId}";
    NSArray* array = @[
                         // Request parameters
                         @"entities=true",
                         @"location={string}",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];

    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"GET"];
    // Request headers
    [_request setValue:@"{subscription key}" forHTTPHeaderField:@"Ocp-Apim-Subscription-Key"];
    // Request body
    [_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
    
    NSURLResponse *response = nil;
    NSError *error = nil;
    NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];

    if (nil != error)
    {
        NSLog(@"Error: %@", error);
    }
    else
    {
        NSError* error = nil;
        NSMutableDictionary* json = nil;
        NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
        NSLog(@"%@", dataString);
        
        if (nil != _connectionData)
        {
            json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
        }
        
        if (error || !json)
        {
            NSLog(@"Could not parse loaded json with error:%@", error);
        }
        
        NSLog(@"%@", json);
        _connectionData = nil;
    }
    
    [pool drain];

    return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';

$request = new Http_Request2('https://developersapi.audioburst.com/v2/user/preferences?userId={userId}');
$url = $request->getUrl();

$headers = array(
    // Request headers
    'Ocp-Apim-Subscription-Key' => '{subscription key}',
);

$request->setHeader($headers);

$parameters = array(
    // Request parameters
    'location' => '{string}',
);

$url->setQueryVariables($parameters);

$request->setMethod(HTTP_Request2::METHOD_GET);

// Request body
$request->setBody("{body}");

try
{
    $response = $request->send();
    echo $response->getBody();
}
catch (HttpException $ex)
{
    echo $ex;
}

?>
########### Python 2.7 #############
import httplib, urllib, base64

headers = {
    # Request headers
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.urlencode({
    # Request parameters
    'location': '{string}',
})

try:
    conn = httplib.HTTPSConnection('developersapi.audioburst.com')
    conn.request("GET", "/v2/user/preferences?userId={userId}&%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

headers = {
    # Request headers
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.parse.urlencode({
    # Request parameters
    'location': '{string}',
})

try:
    conn = http.client.HTTPSConnection('developersapi.audioburst.com')
    conn.request("GET", "/v2/user/preferences?userId={userId}&%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################
require 'net/http'

uri = URI('https://developersapi.audioburst.com/v2/user/preferences?userId={userId}')

query = URI.encode_www_form({
    # Request parameters
    'location' => '{string}'
})
if query.length > 0
  if uri.query && uri.query.length > 0
    uri.query += '&' + query
  else
    uri.query = query
  end
end

request = Net::HTTP::Get.new(uri.request_uri)
# Request headers
request['Ocp-Apim-Subscription-Key'] = '{subscription key}'
# Request body
request.body = "{body}"

response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body