Audioburst Web API V2

3.4 Get Intent based results

Use this API to get specific intent based bursts. Currently supported are Weather and Traffic

Try it

Request URL

Request parameters

string

weather or traffic

string

SourceId to filter on

(optional)
string

The user's device.

Optional values are taken from the Get Supported Devices API.

Request headers

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

Request body

Response 200

Example

{
  "type": null,
  "queryID": 10028709,
  "query": "  Report",
  "actualQuery": "  Report From 11145",
  "bursts": [
    {
      "index": 0,
      "burstId": "ef765f4c-8026-481c-9c4a-d41e6c2e4234",
      "publicationDate": "2018-11-04T07:54:22.399Z",
      "publicationDateISO": "2018-11-04T07:54:22.399Z",
      "creationDate": "2018-11-04T07:54:22.399Z",
      "creationDateISO": "2018-11-04T07:54:22.399Z",
      "title": "10 10 WINS traffic Report",
      "quote": "Queen's verge, fifty ninth street bridge, lower levels going to be shut",
      "score": 0,
      "playlistScore": 0,
      "text": "Leap intent ten wins. In the Meadowlands wins news time to fifty one. Mavis discount tire traffic center. Here's Jeff Jensen little under seven hours to the start of the New York City marathon and already one of our closures in place. That's the verrazano bridge upper level shut while we up until three this afternoon, lower close at seven and tons of rolling street closures. That's what they call them all around town, including the queen's verge, fifty ninth street bridge, lower levels going to be shut that it will happen around seven o'clock this morning too. And here's what you need to know about the bridges and tunnels, the G WBZ's, quiet. There's upper level work both ways for now things. Go until ten in the morning, though. So beware of that Lincoln, and Holland are quiet east of her crossings move. Well, some southbound construction in the van with this morning, south of northern boulevard and get a couple lanes blocked. The pretty quiet looking good on the cross island Parkway, and the clearview and the crash on the southbound side of the New England through a riot is still there over by exit twenty a couple of miles south of the Connecticut state, line course, Sunday parking rules are in effect today. I'm Jeff Jensen next report coming up at three zero one on ten ten wins wins news time.",
      "duration": 62.940000000000055,
      "category": "news.reports.traffic",
      "keywords": [
        "Mavis discount tire",
        "Jeff Jensen",
        "upper level",
        "news time",
        "bridge upper level",
        "York City marathon",
        "cross island Parkway",
        "Sunday parking rules",
        "southbound construction",
        "quiet east",
        "street closures",
        "Jensen next report",
        "lower levels",
        "traffic center",
        "northern boulevard",
        "street bridge",
        "Connecticut state",
        "line course",
        "New England",
        "wins"
      ],
      "entities": [
        "Jeff Jensen",
        "Verrazano Bridge",
        "New York City",
        "Lincoln",
        "New England",
        "Connecticut",
        "Holland",
        "Seven Hours"
      ],
      "source": {
        "sourceId": 11145,
        "sourceName": "10 10 WINS",
        "sourceType": null,
        "showId": 43,
        "showName": "24 Hour News",
        "position": 3090.47,
        "audioURL": "https://storageaudiobursts.blob.core.windows.net/temp/11145_2018110402_t.mp3",
        "imageURL": "https://sapi.audioburst.com/burst/stationimage/ef765f4c-8026-481c-9c4a-d41e6c2e4234",
        "titleSource": null,
        "location": {
          "type": "Point",
          "coordinates": [
            -73.993143,
            40.749541
          ],
          "text": null
        },
        "episodeName": null,
        "network": null
      },
      "contentURLs": {
        "burstURL": "https://sapi.audioburst.com/v2/burst?burstId=ef765f4c-8026-481c-9c4a-d41e6c2e4234&queryId=10028709&appKey=3db63c6c85694a95b412615f6b333079&device=mobile",
        "audioURL": "https://storageaudiobursts.blob.core.windows.net/traffic/68671a53-d996-4b6d-ac80-d6c07484fc6a_48.mp3?userId=Unknown&appName=3db63c6c85694a95b412615f6b333079&qid=10028709",
        "imageURL": [
          "https://storageaudiobursts.blob.core.windows.net/site/images/CategoryIcons/200x200usnews05.png",
          "https://storageaudiobursts.blob.core.windows.net/site/images/CategoryIcons/600x315usnews05.png",
          "https://storageaudiobursts.blob.core.windows.net/site/images/CategoryIcons/1200x630usnews05.png",
          "https://storageaudiobursts.blob.core.windows.net/site/images/CategoryIcons/share_usnews05.png"
        ],
        "searchSiteURL": "https://search.audioburst.com/burst/ef765f4c-8026-481c-9c4a-d41e6c2e4234/2018/11/04/Queen%27s-verge-fifty-ninth-street-bridge-lower-levels-going-to-be-shut?queryID=10028709"
      },
      "DebugTrace": null,
      "transcript": null
    }
  ],
  "message": null,
  "imageURL": null,
  "nextPage": null
}

Code samples

@ECHO OFF

curl -v -X GET "https://developersapi.audioburst.com/v2/intent/{intentName}?stations={stations}?device={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["device"] = "{string}";
            var uri = "https://developersapi.audioburst.com/v2/intent/{intentName}?stations={stations}&" + 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/intent/{intentName}?stations={stations}");

            builder.setParameter("device", "{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
            "device": "{string}",
        };
      
        $.ajax({
            url: "https://developersapi.audioburst.com/v2/intent/{intentName}?stations={stations}&" + $.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/intent/{intentName}?stations={stations}";
    NSArray* array = @[
                         // Request parameters
                         @"entities=true",
                         @"device={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/intent/{intentName}?stations={stations}');
$url = $request->getUrl();

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

$request->setHeader($headers);

$parameters = array(
    // Request parameters
    'device' => '{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
    'device': '{string}',
})

try:
    conn = httplib.HTTPSConnection('developersapi.audioburst.com')
    conn.request("GET", "/v2/intent/{intentName}?stations={stations}&%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
    'device': '{string}',
})

try:
    conn = http.client.HTTPSConnection('developersapi.audioburst.com')
    conn.request("GET", "/v2/intent/{intentName}?stations={stations}&%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/intent/{intentName}?stations={stations}')

query = URI.encode_www_form({
    # Request parameters
    'device' => '{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