Simple tutorial for consuming RESTful API from Flash (AS3)? - actionscript-3

I've built a simple RESTful API for game developers to do things like authenticate against our user store, post scores, and get leaderboards. It's not perfect, but it's very well documented and is working pretty well for 50% of game developers.
The other 50% seem to be Flash developers who just don't get the idea of a RESTful API. I really don't want to build a wrapper for these developers—I'm not a Flash developer, have no interest in becoming one, and really want to keep everything about our API technology-agnostic.
Can anyone recommend a good tutorial on how to consume a RESTful API for Flash developers?

Given my experience with this problem, I suspect this may have less to do with the fact that the developers don't understand the API and more to do with the limitations of the flash player: it simply doesn't support the full range of HTTP methods (at least, not without a proxy) you've probably used in your RESTful API implementation (such as PUT and DELETE).
Flash only supports GET and POST.
If this is indeed the issue, you'll need to offer an alternative to the missing HTTP verbs. I've worked around this in the past by using POST and adding a 'method=http_method' parameter to the query string.
Another gotcha could be your lack of a crossdomain.xml file.

Related

Server technology that allows client to define it's JSON response format

So last year, someone introduced me to an off-the-shelf database server package/ technology that would take a request from a client and would serve up the information in a JSON format that was defined in the request. Having previously had to develop mobile client applications using apis designed for websites, this seemed like a wondrous thing. Being able to make one call and receive only the data you asked for and in the format that suited your code would be a godsend.
Unfortunately, I didn't get the opportunity to work directly with the technology and I have subsequently forgotten what it was called. Neither Google nor StackOverflow has been my friend. It's difficult to formulate the search terms to get the right hit I suppose. Nobody I currently work with has heard of this and I have lost contact with the people who originally introduced me to it.
It's driving me nuts. Does anyone know the name of this package?
The technology I was thinking of was GraphQL.

Connect Sproutcore App to MySQL Database

I'm trying to build my first Sproutcore App and I struggle to connect it to a MySQL-Database or any datasource other than fixture. I can't seem to find ANY tutorial except this one from 2009 which is marked as deprecated: http://wiki.sproutcore.com/w/page/12413058/Todos%2007-Hooking%20Up%20to%20the%20Backend .
Do people usually not connect SC-Apps to a Database? If they do so, how do they find out how to? Or does the above mentioned tutorial still work? A lot of gem-commands in the introduction seems to already differ from the official Sproutcore getting-started-guide.
SproutCore apps, as client-side "in-browser" apps, cannot connect directly to a MySQL or any other non-browser database. The application itself runs only within the user's browser (it's just HTML, CSS & JavaScript once built and deployed) and typically accesses any external data via XHR requests to an API or APIs. Therefore, you will need to create a service wrapper around your MySQL database in order for your client-side app to be able to load and update data.
There are two things worth mentioning. The first is that since the SproutCore app contains all of your user interface and a great deal of business logic, your API can be quite simple and should only return raw data (such as JSON). The second is that, I should mention that the client-server design, while more tedious to implement, is absolutely necessary in practice, because you can never trust the client side code, which is in the hands of a possibly nefarious user. Therefore, your API should also act as the final gatekeeper to validate all requests from the client.
This tutorial I found helped me a lot. Its very brief and demonstrates how to implement a very simple login-app, how to send post-requests (triggered by the login-button-action) to the backend-server and how to asynchronously process the response inside the Sproutcore-App:
http://hawkins.io/2011/04/sproutcore_login_tutorial/

Google Web Engine Api Channel vs Node.js+Socket.io

Please, help me to choose which one to use for my university project (I want to develop a shared multiuser whiteboard).
In particular, I am interested in the performance of message exchange between users and server using Channel API and Socket.io: which one is quicker and why?
I have implemented an initial version of the whiteboard http://jvyrushelloworld.appspot.com/ by following this tutorial: http://blog.greweb.fr/2012/03/30-minutes-to-make-a-multi-user-real-time-paint-with-play-2-framework-canvas-and-websocket/ The code I used is pretty much the same, except for the side and message exchange method: I used python, Google Channel API for message exchange; the guy who wrote the tutorial used Play 2 framework and Web sockets.
As you see, the web socket tutorial version works much faster (don't know if it is my mistake or google api channel performance issue). Of course, a lot of optimization can be done to improve the performance, but I wonder if it is worth to go on using Channel API for that project or is it better to switch to socket.io?

Possible to overload on YouTube API calls?

A project I am working on makes multiple calls to the YouTube gdata API. Usually when I am using the site heavily and going through several pages that use the API, I just stop getting any returns from the API. Those parts of the site load fine, but things usually gathered by the API suddenly cease to load for a while. Is this because the API can't handle successive calls from me like that or because my code is bad?
I know this probably isn't the most constructive answer for Stack Overflow, so please let me know if I need to remove it.
I think you hit some kind of request throttling. As said in the FAQ https://developers.google.com/youtube/faq#operation_limits Youtube limits various of options to prevent to much data/requests.

Database Driven iOS Apps

So this is more of a general question about apps and techniques rather than a specific code question...
When developing an larger app, how would a developer access lots of data from a website. The example I'll use is an app like Yelp. They have both a web-access site and an app, both share the same information. I would imagine that information like that is stored on the website via some sort of MySQL database and the iOS device access's it as needed based on the user's requests.
How might a developer writing an app start something like this? I assume you need to somehow securely tie the MySQL database to iOS and so on. I've seen a lot of techniques on the web, but they all seem very simple and not safe for a large scale app.
Any ideas would be awesome!
The key term you're looking for is "API" (Application Programming Interface).
A Yelp iOS app won't access Yelp's databases directly. There will be a layer (I simplify here somewhat) between that and the iOS app; this layer will provide a series of methods (the API) by which clients can make queries and potentially manipulate remote state.
A common API format is JSON over HTTP, and indeed, this is what the official Yelp API seems to be.
Good starting points would be the documentation for NSURLConnection and NSJSONSerialization, and the Yelp API documentation I link above.