How do I use an API, at the most basic level?
-
I'm trying to use the Tumblr API, and I've gone through the documentation, but there's something more basic that I just don't understand (and can't find an answer to, likely because it's too basic). I have a website in HTML, and I've got my API key all ready, and I'm seeing that I have to use the "get" method - how do I code all that into my HTML website and get a response to show up on my site? This is the method I have to use: api.tumblr.com/v2/blog/{base-hostname}/posts[/type]?api_key={key}&[optional-params=] I have that all ready and prepared with my info - what do I do with it?!
-
Answer:
Do not listen to - that answer is inaccurate and incorrect for so many reasons, the least of which is security. First off - you need to throw in your API calls in your backend. If you use Python, use http://docs.python-requests.org/en/latest/ which is made for things like this. Django will allow you to build those API requests and serve them up into your view. If you use Ruby, look at gems like Koala or TwitterGem (there are ruby gems bundled for dealing with API requests for specific websites). if you need something more general, use http://johnnunemaker.com/httparty/. Secondly, once you make the requests, your backend will read the information and do something with it to display to the user. Thirdly, read the docs. There's two ways to do authentication - API key and private key. An API key is used on a domain-by-domain basis, so it's tied to the domain that makes the requests. A private key is tied to a user, and not a domain. Private key = use the backend. Public API key, you can use javascript -- but you have to do extra stuff to secure the requests your app is making so nobody uses it maliciously.
Giordon Stark at Quora Visit the source
Other answers
You need to use javascript to do the GET. This task is greatly simplified by a librar like JQuery. You would do something like $.ajax("GET", "<URL HERE>"). HTML stands for Hyper Text Markup Language. The intent of HTML is to provide semantic annotation on text and cannot do something like issue requests to other sites.
Louie Dinh
Related Q & A:
- How should I use Youtube API?Best solution by Stack Overflow
- How do I create a digital signature and how do I use it?Best solution by support.office.com
- Where do I find my Yahoo briefcase and how do I use it?Best solution by Yahoo! Answers
- How do you use the Contains Function in Visual Basic?Best solution by go4expert.com
- How do I use chat when I am in a room?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.