3 Replies - 890 Views - Last Post: 29 January 2014 - 12:54 AM

#1 Hashim1   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 30
  • Joined: 13-June 12

Retrieving Information From An API

Posted 28 January 2014 - 06:22 PM

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.

Basically, I need to design and develop a web app which makes use of information from an API. The problem is, I've never worked with one before nor have I ever needed to retrieve information from a server, so I'm overwhelmed just wondering exactly how I'd go about it, and would really appreciate some help in doing so. The only languages I know and have experience with are HTML, CSS and basic Javascript.

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: http://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: http://www.lmiforall...ns-and-answers/. Under the question "What skills would my web developers need to use this?", the answer states:


The LMIForAll Data API works exactly like many other APIs that are commonly embedded in websites, such as the Google, Twitter or Facebook APIs. Your developers will commonly need knowledge of

Javascript (+ any libraries your website uses to access and process the APIs, such as jQuery)
Ö and anything else that your website front end needs to work.

These are fairly low technical requirements. Note that querying the API is made even simpler by the fact that you cannot change or update the data, so your developers can get by entirely on GET requests.

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 more 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:

  • 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?
  • Is it possible to perform a GET request in Javascript? During my research I came across something called the Same Origin Policy - will this affect me?

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. :D/>

Thanks a lot in advance,

Is This A Good Question/Topic? 0
  • +

Replies To: Retrieving Information From An API

#2 blankwavercade   User is offline

  • D.I.C Head

Reputation: 31
  • View blog
  • Posts: 123
  • Joined: 13-December 11

Re: Retrieving Information From An API

Posted 28 January 2014 - 07:47 PM

SO answer to how to get data from an api. Not the best way but it shows the general idea

This wikipedia article is on HTTP. it has a lot of information regarding what things are, it does explain GET requests.

You should be able to request this api and get a response no problem.
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw   User is offline

  • blow up my boots
  • member icon

Reputation: 6544
  • View blog
  • Posts: 26,532
  • Joined: 12-December 12

Re: Retrieving Information From An API

Posted 28 January 2014 - 08:16 PM

You can use Javascript and a feature of this called Ajax to obtain the data. A link for jQuery has already been provided above. jQuery is a Javascript framework which can make working with Ajax easier - but it is also possible to do this in vanilla/pure Javascript.

.. there will probably now follow a number of posts telling you/us how fab and groovy jQuery is..

Explore the first page you linked above, it demonstrates all the information you need (other than how to use JS and Ajax), which is why there is no significant documentation. For example, it reveals links like this:


which is what you would need to use in your Ajax-request to obtain json data like this:


Was This Post Helpful? 0
  • +
  • -

#4 CasiOo   User is offline

  • D.I.C Lover
  • member icon

Reputation: 1576
  • View blog
  • Posts: 3,548
  • Joined: 05-April 11

Re: Retrieving Information From An API

Posted 29 January 2014 - 12:54 AM


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:

The link you posted documents the API pretty well, they can even make the request URL's for you!
It doesn't get any easier than this.. Copy paste the generated URL into your browser if you want to see a live result
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1