Friday, December 31, 2010

HTTP PUT & DELETE from an Actionscript REST client

REST based APIs use the HTTP verbs - POST, GET, PUT and DELETE to accomplish Create, Read, Update, and Delete operations on data respectively. Flash player for various reasons only supports GET and POST. This makes writing REST apps a little harder (an additional line on the client side, and support for an extra request header on the server end) than it should be.


Thankfully, most popular web frameworks provide some support to accomplish this. Ruby on Rails supports overriding the http method using the X-HTTP-Method-Override request header.

The below code tells the RoR server app to consider the request as a PUT operation:

var request:URLRequest = new URLRequest(resource);
request.data = dataToUpdateOnResource;
request.method = URLRequestMethod.POST;
request.requestHeaders.push(new URLRequestHeader("X-HTTP-Method-Override", "PUT" URLRequestMethod.PUT));
var loader:URLLoader = new URLLoader();
loader.load(request);

HTTP DELETE can be achieved using the same.

Saturday, March 27, 2010

Flex 4 launch event at Singapore

Adobe announced the availability of Flash Builder 4 and the opensource Flex SDK 4 earlier this week. This release brings us a major overhaul of the Flex SDK, while also adding support to new technologies(FXG), and future tools like Flash Catalyst.

Here is an excerpt from the official blogpost, detailing where to go to learn more:


As you can see, there are lots of great new features and enhancements in Flex 4 and Flash Builder 4 - too many, in fact to list here. We recommend that you read the "What's New in Flash Builder 4?", "What's New in Flex 4?", and "Introduction to Spark" articles, as well as check out the rest of the new content published on the Adobe Developer Connection site to learn more. Additionally, you can watch David Wadhwani, Vice President and General Manager of the Flash Platform Business Unit describe the new set of products being added to the Flex product family.
I like the Flex testdrive page that they put up as well.

To commemorate the release, The Flex User Group, Singapore and Adobe Singapore have planned a launch event. Flash Platform Evangelist Harish Shivaramakrishnan will be flying in from Bangalore, India to introduce Flex 4 features, and Flash Catalyst. Hu Shunjie will also be discussing the new Spark component architecture. For detailed Schedule, head over to the official FUG blogpost here.

Attendees also stand to win a Flash Builder 4 Premium license from Adobe. Seats are limited, so go ahead, and register for your seat now.