Forums

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

Home Forums JavaScript Working With JSON APIs

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #185568
    KKHAN
    Participant

    Hi guys,

    I want to retrieve data via JSON API. I’ve done this previously with PHP and found out this is probably not the best way as a client side scripting language would be better for this.

    I am asking what is the best framework to learn to help me with this? I’ve really been wanting to learn Anjular JS and just wondering if this framework will help me specifically with this. If you could provide some resources/tutorials on this type of work, it would be great.

    Thanks.

    #185573
    shaneisme
    Participant

    A JSON document is just an object in Javascript. So if you’re working with Javascript, just do something like this:

    http://codepen.io/drainpip/pen/IqkrF

    #185575
    KKHAN
    Participant

    @shaneisme

    I know what a JSON object is, as i have said i have retrieved the information already using php. I think you’ve completely misunderstood or not read properly what i am asking for.

    What i am asking is whats the best practice.

    #185576
    shaneisme
    Participant

    Best practice to do what?

    I want to retrieve data via JSON API. I’ve done this previously with PHP and found out this is probably not the best way as a client side scripting language would be better for this.

    Best practice to retrieve data? Just use the object…

    #185577
    KKHAN
    Participant

    Highlighting 5 words, doesent make up my question. I am talking about frameworks to help me retrieve JSON data via a HTTP API.

    #185579
    shaneisme
    Participant

    I’m saying you don’t need a framework… any framework or back-end language can handle it.

    #185580
    KKHAN
    Participant

    @nkrisc

    I assume it was obvious i am wanting to use front end, as i have posted in the Javascript discussion forum, maybe i could have made that more clear. :)

    #185581
    Alen
    Participant

    If you want to learn Angular JS, you can do it with dummy data. But if you’re interested in bulding API, that’s a backend issue. And it doesn’t really matter what language backend is in, you just need to make sure that your response is a json object.

    So if you request example.com/resources you would only get a json representation of the data.

    I like Laravel framework, if you’re interested there is a series about bulding API at Laracasts.com

    #185582
    KKHAN
    Participant

    @shaneisme

    I am saying i want to know what a good framework is for a big project. My question wasent whether i needed it or not. This was not a quick answer you were hoping for i am sure.

    #185583
    KKHAN
    Participant

    @Alen

    I am not building APIs. Not sure where you got that from. I am wanting to retrieve JSON data via APIs using a Javascript framework and i was wondering if anyone knew a good framework to do this with. I was interested in AnjularJS and wanted to see if anyone knew whether this framework specifically handles it better than alternatives.

    #185584
    Alen
    Participant

    Angular is designed to work with json data in mind so yes it’s a great choice.

    #185587
    KKHAN
    Participant

    @Alen

    Thank you, I noticed you also referenced laracast and i love there tutorials. My follow up question now is do you know any good resources/tutorials on AnjularJS where they retrieve/Manipulate json api url/http data. As it is fairly new territory to me.

    #185588
    Alen
    Participant

    You need to use Angulars $http service to make the request.

    EDIT bellow

    resources/tutorials on AnjularJS where they retrieve/Manipulate json api url/http data

    This is a loaded question, there are many interrelated parts and concepts you need to understand about Angular. I suggest you read little bit more about it. There are many free resources. Including free YouTube tutorials and talks.

    You asked about “best practice”… in this case for example I would create a Service and Factory to get the appropriate data. But that entails you understanding dependency injection (which Angular is good at) but you still need to understand what’s going on.

    #185590
    KKHAN
    Participant

    @Alen, thats awesome man ty.

    For doing specifically what i wanted i found a good tutorial on pluralsight he covers $http in lesson 205.

    AngularJS : Getting Started

    I’ve been to a few popular tutorial sites i go to and the course on this particular site seemed the best as it assumes no prior knowledge of angujarjs. I will deffi be going through the entire course.

    #185598
    __
    Participant

    If you want to learn Angular, then great! Go ahead. Yes, it handles JSON just fine.

    All in all, though, I’m with @shaneisme. If you’re looking for the most straightforward solution, it’s not a framework: it’s just ajax (or however you access the api) and JSON.parse.

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