Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Retrieving, understanding and displaying a JSON feed on my site. (advice needed!)

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #39516
    staticwaves
    Member

    do you have any suggestions on how i can learn to retrieve a JSON event listing feed, convert the language and display in my own style?
    Are templates available?
    I need to learn what each code document i need and what they do.
    I have seen many tutorials, but they are all very advanced and don’t explain the big picture.

    #108477
    staticwaves
    Member

    Hey Traq, thanks for looking in to this.
    I need to retrieve the data from ticketfly.com – basically i need to list events like they have on their site, but with my own styling. I will have the following feeds:
    upcoming events, single event, featured event and just announced events.

    #108482
    TheDoc
    Member

    My only experience is using jQuery for this, but I think it looks *very* similar in PHP.

    I’ll give you an example of some code I use for Twitter’s API:

    $.ajax({
    url: 'https://api.twitter.com/1/statuses/user_timeline.json?screen_name=[twitterUserName]&count=20&callback=?&include_rts=true',
    dataType: 'jsonp',
    success: function(data) {
    // do something with the data
    // to see what the data is returning, you can log it to the console
    // by going console.log(data);
    },
    error: function() {
    // something is borked - display an error message
    }
    });

    So you would replace [twitterUserName] with a username and you’d return a bunch of information in a file that looks like: https://api.twitter.com/1/statuses/user_timeline.json?screen_name=graygilmore&count=20&callback=?&include_rts=true

    It might look all jumbled, but that’s just because the browser is putting it all together on one line. If you take that data and paste it into here: http://jsbeautifier.org/ you’ll see that it’s actually neatly sorted.

    So let’s say we wanted to get some information from that call. Let’s try to find out how many people I’m following. Inside our success function I would do something like this:

    var following = data[0].user.friends_count

    We’re just following the chain of where that information lives. First object in the Data array > User > Friends Count. It’s pretty simple, really!

    If we wanted to do something different for each tweet, we could do something like this:

    $.each(data, function() {
    // do something with each tweet
    });
    #108546
    staticwaves
    Member

    Thanks for the info Doc.

    Traq – i do have all of the documentation for the ticketfly api. I just dont know what to do with it yet.

    I am very new at this and really dont know what documents i need and where to put them in my wordpress site. I do have all of the correct request codes and and can pull up the feed in a browser.. just cannot figure out how to integrate it in my site.

    #108576
    staticwaves
    Member

    i guess i need to take javascript tutorials??

    #108579
    staticwaves
    Member

    gotcha. it is my understanding that wordpress is php.. am i correct?
    if so, php it is. i know basics of HTML and CSS -thats about it. I am working on learning PHP and Javascript, but those both seem like a steep climb. What language would you guys recommend?
    It would be a dream to be able to find a plugin for this.

    #108699
    staticwaves
    Member

    Probably front end stuff. I think we should go with javascript for now. Is TheDoc’s example the only file that i would have to add? I assumed that i need a few different files to make this happen.

    #108744
    wehk
    Member

    Maybe you can go for the language you are familiar with. For example, if you are good at php, you may convert the JSON to array and do whatever you like in php and then add whatever deisgn elements to it.

    #108792
    staticwaves
    Member

    Cool! thanks for all of the advice Traq. I will get started on learning Javascript. As soon as i get started on the code for this api, ill let you know! again, i really appreciate the help!

    #108828
    TheDoc
    Member

    I remember starting out dealing with APIs and feeling totally overwhelmed. Everything was confusing and even if I did get the result that I wanted I was never quite sure how it worked (too much copying and pasting from other resources).

    But eventually you have to tinker with it enough that you start to understand what’s going on. The next thing you know you’re building themes that actually rely on using some pretty complicated APIs!

    #108929
    staticwaves
    Member

    haha, so its not just overwhelming only to me! The main reason that it is overwhelming is that i do not see a clear route to learning it. I have not been able to find (maybe from not knowing the lingo) a tutorial that is easy to follow.
    I seem to be spending hours looking for the right one. I started the tutorial on Javascript at w3schools, but that seems more like a reference than a step by step learning process. Do you suggest any solid free tutorials? At this point in time, i cannot afford a paid tutorial.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘Other’ is closed to new topics and replies.