Using your first API

Cloud Computing - Data Science
API

Last day we learnt what is API and why we need API as a developer. And Today we will learn and use our first API in our script. Like we said we will send the request to the server in a predefined format and the server will return the information we want.

Using API

Currency API:

For the fist call we choose an API which do not need any credential to use it. This gives us the foreign exchange reference rates both current and historical data. It was published by European Central Bank. And you can learn all the requests from this API website.

For this post we will use Request library on Python to get the data from the server.

libraries
Importing libraries
API website
The request URL from the website

At first we import the libraries and check out the request format from the website.

Then we will send the request. using the get function and the predefined URL to get the data which we will parse and print.

From the printed result we can see the result is in Json format, which most of the API responses are. And the base currency is Euro. And also the data is latest, which we know from the date.

Let us find out the exchange rate of EUR to USD.

Currency Data
Data printed in the format we wanted. Like this we extract all the data from the json.

Now let us look for ways to customize our request and extract different data.

From the API website we see we can extract historical currency data by swapping the ‘latest’ with a date and we can change the base currency adding it to the URL with ‘?base=’ at the end.
like we will use the URL

https://api.exchangeratesapi.io/2015-09-28?base=USD

getting historical data
changing base currency

From the result we can see the base currency is changed to USD and the date is changed to September 28th, 2015.

Final result
Customizing the requests and print the response

You can use this API to do a lot of projects. Like you get your script hosted on cloud which sends you currency change analysis on schedule like in a certain time everyday.

51 thoughts on “Using your first API”

  1. This fnb.xwrj.datalators.com.rey.lo isn’t blood-borne vastus [URL=http://bodywit.com/buy-viagra-online/ – best website use generic viagra[/URL – [URL=http://columbiainnastoria.com/cialis-price/ – cialis generic[/URL – [URL=http://buynewaustin.com/achat-kamagra-en-france/ – kamagra mit alkohol[/URL – [URL=http://redlightcameraticket.net/toradol-injection/ – buy toradol injection online[/URL – [URL=http://sci-ed.org/viagra-buy-in-canada/ – can caverject be used with viagra[/URL – [URL=http://handleyumc.org/online-viagra/ – viagra in india[/URL – [URL=http://anguillacayseniorliving.com/levitra-generic/ – levitra experiences old[/URL – [URL=http://ecareagora.com/pharmacy/ – pharmacy[/URL – [URL=http://mannycartoon.com/cialis-professional/ – cialis professional 20 mg[/URL – [URL=http://damcf.org/item/ascorbic-acid/ – ascorbic acid price[/URL – [URL=http://ecareagora.com/propecia-generic/ – propecia generic[/URL – [URL=http://thepaleomodel.com/levitra-genericos/ – generic levitra shipping[/URL – faculties modulated buy viagra online cialis.com generic cialis 20mg viagra on line toradol injection on internet cheap viagra online online viagra levitra generic pharmacy prices for levitra pharmacy cialis professional capsules for sale cheap ascorbic acid where to buy propecia online levitra existence, http://bodywit.com/buy-viagra-online/ uk viagra no prescription http://columbiainnastoria.com/cialis-price/ cialis http://buynewaustin.com/achat-kamagra-en-france/ kamagra phone in orders http://redlightcameraticket.net/toradol-injection/ canadian toradol injection toradol injection on internet http://sci-ed.org/viagra-buy-in-canada/ acheter du viagra viagra http://handleyumc.org/online-viagra/ viagra http://anguillacayseniorliving.com/levitra-generic/ levitra 20 mg online http://ecareagora.com/pharmacy/ pharmacy prices for levitra http://mannycartoon.com/cialis-professional/ cialis professional 20 mg http://damcf.org/item/ascorbic-acid/ ascorbic acid best price http://ecareagora.com/propecia-generic/ propecia without prescription buy propecia without prescription http://thepaleomodel.com/levitra-genericos/ levitra online pharmacy 7c levitra genericos documented therapists deposit monocytes.

  2. Definitely believe that which you stated. Your favorite justification seemed to be on the
    internet the simplest thing to be aware of. I say to you, I definitely get annoyed while people consider worries that they
    plainly do not know about. You managed to hit the nail upon the top as
    well as defined out the whole thing without having side-effects , people can take a
    signal. Will likely be back to get more. Thanks

  3. It’s perfect time to make some plans for the future and it
    is time to be happy. I’ve read this post and if I could I desire to suggest you few interesting things or suggestions.
    Maybe you could write next articles referring to this article.
    I want to read more things about it!

  4. My programmer is trying to persuade me to move
    to .net from PHP. I have always disliked the idea because of
    the expenses. But he’s tryiong none the less. I’ve been using Movable-type on several websites
    for about a year and am nervous about switching to another platform.
    I have heard fantastic things about blogengine.net.
    Is there a way I can transfer all my wordpress posts into it?
    Any kind of help would be really appreciated!

  5. Unquestionably believe that which you said.
    Your favorite justification appeared to be on the web the easiest factor
    to bear in mind of. I say to you, I definitely get irked at the same time as other people consider issues
    that they just don’t understand about. You managed to hit the
    nail upon the top as well as outlined out the whole thing without having side effect
    , other people can take a signal. Will probably be
    back to get more. Thanks

  6. I blog quite often and I truly thank you for your content.
    Your article has really peaked my interest. I am going to bookmark
    your blog and keep checking for new details about once a week.
    I subscribed to your RSS feed too.

  7. This is really interesting, You are a very skilled blogger.
    I have joined your feed and look forward to seeking more of your
    great post. Also, I have shared your web site in my social networks!

  8. This design is spectacular! You obviously know how to
    keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Excellent job.
    I really loved what you had to say, and more than that, how
    you presented it. Too cool! 0mniartist asmr

  9. Hello there! I know this is kind of off topic but I was wondering if you knew where I could get a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m having
    difficulty finding one? Thanks a lot! 0mniartist asmr

  10. Hi! I could have sworn I’ve been to this website before
    but after browsing through some of the post I realized it’s
    new to me. Nonetheless, I’m definitely happy I found it and I’ll be book-marking and checking back often!

  11. I just couldn’t leave your web site prior to suggesting that I actually enjoyed the standard info a
    person supply on your visitors? Is gonna be again often in order to check up on new posts

  12. Please let me know if you’re looking for a author for your blog.

    You have some really good articles and I think I would be a good asset.
    If you ever want to take some of the load off, I’d love to
    write some material for your blog in exchange for a link back to mine.

    Please send me an email if interested. Kudos!
    0mniartist asmr

  13. Thank you a bunch for sharing this with all people you
    actually know what you are talking about! Bookmarked.
    Please additionally talk over with my site =). We may
    have a hyperlink change agreement between us

  14. I do trust all of the ideas you’ve offered on your post.
    They’re really convincing and will definitely work.
    Nonetheless, the posts are too short for starters.
    May just you please lengthen them a bit from subsequent time?
    Thanks for the post.

  15. Hey there are using WordPress for your site platform?
    I’m new to the blog world but I’m trying to get started
    and create my own. Do you require any html coding expertise
    to make your own blog? Any help would be really appreciated!

  16. For most recent information you have to go
    to see world-wide-web and on the web I found this
    site as a finest website for most recent updates.

  17. Hey! Quick question that’s totally off topic.
    Do you know how to make your site mobile friendly?
    My website looks weird when browsing from my apple iphone.
    I’m trying to find a theme or plugin that might be able to fix this problem.
    If you have any recommendations, please share. Thanks!

  18. I’m amazed, I must say. Rarely do I encounter a blog that’s equally educative
    and engaging, and without a doubt, you have hit the nail on the head.
    The issue is an issue that too few people are speaking
    intelligently about. I am very happy that I found this in my hunt for something relating to this.

  19. scoliosis
    I’m impressed, I have to admit. Rarely do I encounter a blog
    that’s equally educative and engaging, and let me tell
    you, you have hit the nail on the head. The issue is something that too few men and women are speaking intelligently
    about. I’m very happy that I came across this in my search for something concerning this.
    scoliosis

  20. scoliosis
    A person necessarily assist to make critically posts I might state.

    That is the very first time I frequented your web page and thus far?
    I amazed with the research you made to create this actual publish amazing.
    Fantastic task! scoliosis

  21. free dating sites
    After I initially left a comment I seem to have clicked the -Notify me
    when new comments are added- checkbox and from now on whenever a
    comment is added I recieve four emails with the same comment.
    Is there a means you can remove me from that service?
    Kudos! free dating sites

  22. Aw, this was a very nice post. Taking a few minutes and
    actual effort to make a top notch article… but what
    can I say… I put things off a lot and don’t seem to get anything done.

  23. Hi, Neat post. There’s a problem with your website in internet explorer, could check this?

    IE still is the marketplace chief and a large portion of other people will leave
    out your wonderful writing due to this problem.

  24. Hey There. I discovered your weblog the usage of msn. This is a really well written article.
    I’ll make sure to bookmark it and come back to read extra of your helpful
    information. Thanks for the post. I’ll definitely comeback.

  25. Wow, superb blog format! How long have you been running a blog for?
    you make blogging look easy. The whole look of your web site is great, let alone the content!

  26. Pingback: Google

Leave a Comment

Your email address will not be published.