Archive for the ‘API’ Category
Defining a SAP Flash Islands candidate: MashUp’s using existing Adobe components
In the good old days when the SAP Portal was brand new and everybody discussed what kind of content would/could be available in there in the near future, there was always one example which was demo’ed again and again: The Stock ticker or The list of preferred stocks and related updates. Although we knew that most customers did not have this “need”, the demo continued to survive – and it took a while before there was a real proposal on serious content.
Will the same thing happen to SAP Flash Island?
…. will Google Maps examples and colour full Piechart examples be the “Stock ticker” for SAP Flash Island?
Maybe… or maybe not… maybe there are a lot of inspiration to find in the Adobe Flex community, because there are already a lot of exising components and applications available – and a lot of different API’s are already supported by Adobe Flex. The inspiration might lead you to a ‘non-stock-ticker’ for SAP Flash Island.
If you visit Adobe.com/devnet you might find some inspiration to a new mashup – which could be a SAP Flash Island candidate – just to mention a few:
How to use authorization headers in an Adobe AIR Application
If you want to use some of the Google API’s in an Adobe AIR application you might run into some tricky issues regarding authorization headers. In this example, I will try to show you how to receive this Auth header token and then use it for subsequent calls to methods in the Google API later in the process.
In the following example – I will show you how to connect to Google Spreadsheet
The Google login (named ClientLogin) and methodcall is done in two steps. First step is to call the ClientLogin url (https://www.google.com/accounts/ClientLogin) in order to tell Google what service you would like to access and also pass your username/password for this account. If the uservalidation is succesfull then Google will send an Auth token in the response. You need to use this token in any other subsequent calls to methods in the Google API.
Next step is to call a method in Google spreadsheet – and in this example we will retrieve a list of spreadsheet objects. And here it’s important to pass the authorization header:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
import mx.utils.Base64Encoder;
[Bindable]
private var AuthString:String;
private function CallHTTP():void
{
google.send();
}
public function handleLoginPlain(event:ResultEvent):void
{
var textindex:int;
textout.text = event.result.toString();
AuthString = event.result.toString();
textindex = AuthString.search("Auth");
AuthString = AuthString.substring(textindex);
AuthString = AuthString.replace("Auth=","");
textindex = AuthString.length;
textindex = textindex - 1;
AuthString = AuthString.substring(0,textindex);
key.text = AuthString;
googleaccount.headers =
{Authorization:"GoogleLogin auth="+AuthString.toString()};
googleaccount.send();
}
public function handleLoginFault(event:FaultEvent):void
{
Alert.show(event.fault.faultString, "Error");
}
public function handlePlaindata(event:ResultEvent):void
{
Alert.show('You are connected to Google Spreadsheet',
'Login', mx.controls.Alert.OK);
}
public function handleFaultdata(event:FaultEvent):void
{
Alert.show(event.fault.faultString, "Error");
}
]]>
</mx:Script>
<mx:HTTPService id="google"
url="https://www.google.com/accounts/ClientLogin"
method="POST"
contentType="application/x-www-form-urlencoded"
result="handleLoginPlain(event);"
fault="handleLoginFault(event);" >
<mx:request xmlns="">
<accountType>GOOGLE</accountType>
<Email>enter your e-mail address here</Email>
<Passwd>enter your password here</Passwd>
<source>enter your application name here</source>
<service>wise</service>
</mx:request>
</mx:HTTPService>
<mx:HTTPService id="googleaccount"
url="http://spreadsheets.google.com/feeds/spreadsheets/private/full"
result="handlePlaindata(event);"
fault="handleFaultdata(event);" />
<mx:Button id="login" x="40" y="30" label="Login" click="CallHTTP()"/>
<mx:TextArea id="textout" x="40" y="60" width="400" height="260"/>
<mx:TextInput id="key" x="104" y="30" width="336"/>
</mx:WindowedApplication>