Stubhub API issue with json and access origin
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

Hi there,

I have a final year project coming up. I am needing to use stubhubs api to grab the prices from an event. For example http://www.stubhub.co.uk/queen-tickets/queen-and-adam-lambert-wembley-the-sse-arena-wembley-24-2-2015-9175800/

I have managed to find a json link to stubhub. https://www.stubhub.com/ticketAPI/restSvc/event/9175800/sort/price/0?ts=1396358054406 But im am stuggling to do anything with it!

Normally i would use kimono labs to grab apis

$.ajax({
type: 'GET',
crossDomain: true,
dataType: 'jsonp',
url: 'api link here',
success: function (json) {
//var json = $.parseJSON(data);
for(var i =0;i < json.results.collection1.length;i++) {
var title = json.results.collection1[i].Name.text;
var venue = json.results.collection1[i].Venue.text;
var date = json.results.collection2[i].Date;
var button = "<button class='redirect-button' data-url='"+(i+25635)+".html'>Link</button>";
$("#apple").append("<tbody><tr><td>"+title+"</td><td>"+venue+"</td><td>"+date+"</td><td>"+button+"</td></tr></tbody>");
$("#apple").find(".redirect-button").click(function(){
location.href = $(this).attr("data-url");
});
}
},
error: function(error){
console.log(error);
}
});

What im needing is the data thats in the table on stubhub (the seat area and ticket price) and to place it in the existing table thats in the json query. More help the better!

Currently when i try to access the site as a json datatype ( i know it says jsonp, its just an example of what i have been using) i gett the no access error in console. is there a work around (ANY WORKAROUND WILL DO! All i need is the site to constantly update which is why i cant just download the json and format it)

Willing to tip alot more if full solution given.

i entered your link https://www.stubhub.com/ticketAPI/restSvc/event/9175800/sort/price/0?ts=1396358054406 in browser - it says 'access denied'. what is correct api endpoint url?
jonny64 6 years ago
well on my screen it shows the full json code. Apparently i don't have the correct oauth. How would i do this? i do get an api key and api secret. Ideas?
samnymr 6 years ago
awarded to Be The Match

Crowdsource coding tasks.

1 Solution


in order to resolve cross domail request issue

you can use yahoo pipes (https://pipes.yahoo.com/pipes/) to parse your page and get correct jsonp response from yahoo pipes api

here is similar example https://bountify.co/javascript-code-to-access-clinicaltrials

please see comment above
samnymr 6 years ago