Develop JavaScript API to expose services - javascript

We are planning to develop a JavaScript API to expose some of our Java EE based services. We are doing this keeping Google Maps API
in mind. Can someone please suggested where we should start and the approaches that we need to follow to create a useful and
extensible JavaScript API? Any suggestion will be greatly helpful for us.

More than google maps, I think you should look at twitter which has a very nice REST API. (https://dev.twitter.com/docs/api) REST is the key of building your API.
Part from that, you should also think about generating API keys, so you have control about who is doing what with your services
Also that seems like a good reading to start:
http://blog.steveklabnik.com/posts/2011-07-03-nobody-understands-rest-or-http

Definitely look to make it a RESTful JSON Api and then you'll be able to use it for various purposes. APIs like twitter et. al. are good models (although there is a lot of back and forth about what is completely REST).
I'm a big fan of Mike Pearce's take on how to design good APIs: http://blog.mikepearce.net/2010/08/08/api-anti-patterns-how-not-to-write-a-restful-api/

Related

Calling Amazon Alexa APIs with JavaScript (for using AVS, not for skill development)

I am trying to develop a JavaScript based app that will interact with Alexa.
How can I call Alexa Voice Service APIs using JavaScript? (I am planning to utilize XMLHttpRequest for AVS connection.)
There is only an example Java app and it's a bit complicated for me to understand it.
Please note that my need is simple, I am not planning to develop Alexa skills, but just call the API from JavaScript.
I would start with the official documentation. It is quite thorough. Please reference the following:
https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/docs/authorizing-your-alexa-enabled-product-from-a-website
https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/content/avs-api-overview
(^ especially the Interfaces section)
Perhaps I misunderstand what you are asking, but that should be enough to get you up to speed.

Runescape Tracker - What do i need to know to make one?

I'm new to the programming world and i'm eager to learn but i've heard that the best way to learn is by having a nice project to work on. And i've always wanted to make a Skill Tracker for my clan. Could you guys give me any advices on what i should learn before being able to start on such a project.
I'm basically looking to make something like: http://runetrack.com/competitions/
I'm familiar with variables, loops, if else statements etc etc. But whenever i try to make a tracker or a simple highscore i get lost because i don't know where to start.
Cheers.
Basically Javascript and html for front end development.
Runescape has a rest API for high scores and the GE (http://services.runescape.com/m=rswiki/en/Grand_Exchange_APIs). You can interact with this API by using AJAX calls.
If you want to host the website, learn how to deploy a simple Apache web server.
Just learn the things I mentioned above: Html, Javascript, AJAX calls (using jQuery) and deploying a simple Apache server. This is more than enough. Along the way you'll pick up other technologies that you might want to use in developing your website.
RuneScape has an api for highscores and the grand exchange. See http://services.runescape.com/m=rswiki/en/Hiscores_APIs . Example of my character: http://services.runescape.com/m=hiscore/index_lite.ws?player=aarony . As for what to output it to, I suggest google apps script to get started.
I created my own google site using the above. If you would like to use it for ideas, you can see it here: https://sites.google.com/site/runescapeaarony/

How does Google protect the Maps Java script API

I have starting looking into the classic newbie question of protecting a javascript API. Using API keys and such. I have also found the classic answer, that it can't be done. At least not completly secured.
Then I start thinking. When I use Google Maps javascript API, I provide a API key. Somehow I doubt that Google exposes there quite extensive API if API keys can be stolen simply by copying the key.
So How does google protect their API? How do I adapt this in my service?

Good examples/templates/best practices API documentation

Im creating the front end for a web service, and another company the back end. I need a good, simple and easily understandable way of making a document of API calls that we can collaborate on and edit together without confusing one another.
are there any good specs/examples etc of project API documentation so this doesnt get in a huge mess with many re-writes?
My choice for documentation: Sphinx.
Others:
epydoc
pylit
But Sphinx is quite awesome.
For small APIs I´ve began to use Google Docs. Its collaboration features are awesome and you can see a list of all changes made on this document.

App Engine and Facebook: which libraries to use?

I will be developing a web application with Google App Engine that will use Facebook Connect as the only means of registering / logging in. The web app will be written in Python. I need to know their name, profile pic, how many friends the user has, as well as their age and also possibly location, relationship status, work info, etc. (although those are mostly optional besides name, pic, age and friend count).
There seem to be a number of libraries that can do the task. There is the official Facebook Javascript SDK, minifb, and pyfacebook to name a few.
How do you think I should go about this task? Which libraries should I use, and what are the pros / cons?
Also to be considered is how well documented the code is and how widely it is used. If you can provide links to relevant example code / documentation, that would be greatly appreciated.
Facebook python-sdk has an example application to use Facebook connect with Google App Engine. I guess, you are looking for the same.
This should be a comment for the answer which suggests using the Facebook python-sdk.
Note that at github it says
This SDK is deprecated. It does not support the new cookie format that
we rolled out as part of the OAuth Migration. In short, it doesn't
work.
I've had success with the facebook-sdk project, which I believe is a fork of Facebook's original (and now dead) python-sdk project noted above. However you may also wish to check out EngineAuth.
Why don't you check out this similar question asked by another StackOverflow user:
Simple Facebook Connect in Google App Engine (Python)
There are some links provided here that sound exactly like what you're looking for.
For all specified detail you need to go with respective permission from users and then you can extract all specific information you needed.
You can go by either Graph Api or Javascript Api:
But with javascript you need to use many ajax request through your application where graph api only need access_token once for particular instance and also independent of client action.
Graph API also helps you in preventing use of other framework like pyfacebook, minifb, etc.
Apart from pros and cons you can also look some example code for both javascript and graph api
Hope this information will be useful to you.

Categories