January 28th, 2014, 07:20 PM
Retrieving Information From An API
Hi there. Firstly, the only reason I've posted this thread in the JS section is cos I genuinely have no idea where it goes, and this makes the most sense to me. Hope I'm right in thinking that. Sorry if it could have been better placed.
The API that I intend to retrieve information from is called the LMI For All API, and basically consists of lots of statistics on careers in the UK. The explorer for the API can be found here: api.lmiforall.org.uk/. The problem is, there's no real documentation to go with it, and the only thing that indicates to me how I might go about working with it is located in the FAQ: lmiforall.org.uk/questions-and-answers/. Under the question "What skills would my web developers need to use this?", the answer states:
Other than that, I've no idea where to start. I've done some searching on GET requests and the like, but what I got made me none the wiser, if not a little perplexed.
Essentially then, what I'm looking for is an explanation to a total newbie - as detailed as can be, if possible - on retrieving information from a server and how it's done. Specifically, if the following questions could be answered, I'd be a very happy chap:
I understand that I'm asking quite a lot, but as I said, having had no experience with anything of the sort, I'm kinda overwhelmed with what's in front of me, and I really do need to know. Therefore, I'd appreciate the education and anyone willing to educate a newbie.
- In a case such as this, what would be the best/standard/recommended method to retrieve information from a server?
- What is a GET request, how does it work, and should I use one in this case? If I should, how do I?
- If not, what should I use?
Thanks a lot in advance,
January 30th, 2014, 11:49 AM
You need to get the JSON data (of whichever category you want to display) by clicking on the link "Raw". From there..., there's a few ways you can import & display the data.
- You can use jQuery's $.getJSON() API
- You can use a server-side language (if your server allows you to use one); like PHP, to scrape the JSON file and add it to a variable. Then you would have an multi-dimensional object; which you can access with the objects keys.
- You can embed the json with a script tag and then you could use JSON.parse() to access the object and display the data.