Présentation des APIs Orange Partner par Thierry Gaillet le 16 avril 2015.
L'enregistrement est online sur la chaine de la Mobile Banking Factory 2 : https://bitly.com/youtubeMBF2
25. Peter can then be treated like a VIP at all time.
GymTech
Welcome back to GymTech
Your digital coach at the Gym.
OK
Do you want to give it a try?
Cancel
BRAND NEW FOR YOU!
26. And of course, he keeps total control over the notification mechanism.
50. Orange
Datavenue
APIs
Marco,
GymTech CTODatavenue portal
Access API
GymTech’s platforms
apps
Jim in
control,
as Gym
manager
Aggregation API
Other data
Store
Manage
Secure
GymTech’s
H/W + S/W
Collect APIPeter,
the
end-user
< / >
Then he can access, manage and visualize data for his apps & services.
51. Orange
Datavenue
APIs
Marco,
GymTech CTODatavenue portal
Access API
GymTech’s platforms
apps
Jim in
control,
as Gym
manager
Aggregation API
Other data
Store
Manage
Secure
other
apps
other platforms
Future
Sharing APIs
- Jim’s data, with his consent
- Anonymized data
3rd Party
GymTech’s
H/W + S/W
Collect APIPeter,
the
end-user
< / >
Eventually, 3rd parties can access data with explicit consent from Jim…
52. Orange
Datavenue
APIs
Marco,
GymTech CTODatavenue portal
Access API
GymTech’s platforms
apps
Jim in
control,
as Gym
manager
Aggregation API
Other data
Store
Manage
Secure
other
apps
other platforms
Future
Sharing APIs
- Jim’s data, with his consent
- Anonymized data
3rd Party
GymTech’s
H/W + S/W
Collect APIPeter,
the
end-user
< / >
…or access sets of aggregated & anonymized data.
74. Peter uses his smartwatch to take a snapshot of his best performance ever.
GymTech congrats!
best time ever
15+ km/h
75. Save this moment
to your Orange Cloud
This handy remote control could even let him save this moment to his cloud.
76. It’s Marco who developed the GymTech app and smartwatch extensions.
Peter
GymTech
app user
Marco
GymTech app
developer
77. But how did Marco manage to interface Peter’s personal cloud directly?
Peter
GymTech
app user
Marco
GymTech app
developer
?
Peter’s
personal cloud
at Orange
79. Let’s focus on the user experience first, at the Gym.
Peter
end user
Peter’s
personal
cloud
GymTech
app
80. The first time Peter launches the app…
Activation code
We have sent an SMS with your
activation code.
Please enter this code below
Code:
GymTech
81. …he’s invited to select the personal cloud he wants GymTech to use.
Activation code
We have sent an SMS with your
activation code.
Please enter this code below
Code:
GymTech
Your personal cloud
Welcome to GymTech
Your digital coach at the Gym.
As your privacy is our top priority,
we will only store pictures and logs
in your own private space.
82. For Orange Cloud, Peter signs-in with his Orange (mobile or box) credentials.
Activation code
We have sent an SMS with your
activation code.
Please enter this code below
Code:
peter.2020@orange.fr
●●●●●●●
83. Peter can then authorize the GymTech app to access his personal cloud.
Activation code
We have sent an SMS with your
activation code.
Please enter this code below
Code:
peter.2020@orange.fr
**********
peter.2020@orange.fr
84. And… voilà!
Activation code
We have sent an SMS with your
activation code.
Please enter this code below
Code:
peter.2020@orange.fr
**********
GymTech
Orange Cloud storage: 63% left
Thank you
GymTech can now access your
Orange Cloud, in the following
root directory:
mes dossiers partenaires/GymTech/
OK
85. The GymTech app can upload, browse and manage files in Peter’s cloud.
Activation code
We have sent an SMS with your
activation code.
Please enter this code below
Code:
peter.2020@orange.fr
**********
GymTech
+
15+ km/h
92. …and browse the specific GymTech folder.
Peter
Forever
Pocket Scanner
GymTech
93. Peter gets a summary of all partners’ apps accessing his cloud.
GymTech
Peter
GymTech
94. At any time, Peter can revoke access to his cloud.
GymTech
Peter
GymTech
95. Now let’s come back to Marco, the GymTech developer.
Marco
GymTech CTO
96. Marco just needs his GymTech app to access Peter’s cloud.
Peter
GymTech
app user
Marco
GymTech app
developer
Peter’s
personal cloud
at Orange
97. It’s so easy with the Orange Cloud APIs.
Orange Cloud APIs
GymTech’s
backend
98. But first, Marco needs Peter to login and consent, using the Orange Identity APIs.
Orange Cloud APIs
Orange Identity APIs
99. As trusted party, Orange uses the ultimate Open ID Connect (OIDC) standard.
Orange Cloud APIs
Orange Identity APIs
100. Orange then calls back GymTech app or service platforms.
Orange Cloud APIs
Orange
Identity
APIs
101. Marco instantly integrated all these APIs in his code, thanks to the Orange SDKs.
Orange Cloud APIs
Orange Identity APIs
Orange
SDKs
102. // in main controller
- (void)viewDidLoad {
[super viewDidLoad];
// Create the object that will make both user authentication
// and cloud session management
self.cloudSession = [[CloudSession alloc] initWithAppKey:@"yourClientId"
appSecret:@"yourClientSecret"
redirectURI:@"yourURIredirect"];
}
// in app delegate
- (void)applicationDidBecomeActive:(UIApplication *)application {
[self.mainController connect];
}
Orange Identity & Cloud SDK
Marco also gets a complete sample code, ready to run and copy/paste…
103. // in main controller, how to connect:
- (void) connect {
[self.cloudSession openSessionFrom:self success:^{
[self.cloudSession rootFolderWithSuccess:^(CloudItem * cloudItem) {
[self setViewControllers:@[[[FileListViewController alloc]
initWithSession:self.cloudSession
item:cloudItem]]];
} failure:^(CloudStatus status) {
NSLog (@"Error while getting root folder");
}];
} failure:^(CloudStatus status) {
NSLog (@"Error while connecting user");
}];
}
…with high-level SDK function calls, as shown here for iOS.
104. …same for Android, in MainActivity…
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
mStack = new Stack<OrangeCloudAPI.Entry>();
setContentView(R.layout.activity_main);
mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);
mSwipeRefreshLayout.setOnRefreshListener(this);
list = (ListView) findViewById(R.id.list);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
// Get element at position and browse if it is a folder
OrangeCloudAPI.Entry entry = (OrangeCloudAPI.Entry) adapter.getItem(i);
if (entry.type == OrangeCloudAPI.Entry.Type.DIRECTORY) {
browseFolders(entry);
} else if (entry.type == OrangeCloudAPI.Entry.Type.IMAGE) {
previewImage(entry);
}
}
});
AuthSession session = new AuthSession(MainActivity.this, APP_KEY, APP_SECRET, APP_REDIRECT_URI);
mApi = new OrangeCloudAPI<AuthSession>(session);
session.startAuthentication();
} else {
mainStateNonce = savedInstanceState.getString("mainStateNonce");
}
}
105. with a clean Open ID Connect session.
@Override
protected void onResume() {
super.onResume();
//////////////////////////////////////////////////////////////////////////
// The next part must be inserted in the onResume() method of the
// activity from which session.startAuthentication() was called, so
// that Orange authentication completes properly.
//////////////////////////////////////////////////////////////////////////
final AuthSession session = mApi.getSession();
// need to be sure that is first loading!
if (mainStateNonce == null) {
session.checkAuthentication(new OrangeListener.Success<String>() {
@Override
public void onResponse(String response) {
// Have a valid session:
// Browse the root folder and display its contents
// null -> because we need root folder of app!
browseFolders(null);
mainStateNonce = "mainStateNonce";
}
}, new OrangeListener.Error() {
@Override
public void onErrorResponse(OrangeAPIException error) {
failure(error, true);
}
});
}
}
106. Not to forget Python…
…
from pyorangecloud import OrangeCloudClient
app = {'clientId':'xxx','clientSecret':'yyyyy','redirectUri':'http://my:redirect/uri'}
client = OrangeCloudClient(app,authCode=‘xxx')
print("Available space: %s" % client.freespace())
print("Default folder list: »)
folderInfo = client.listFolder()
for f in folderInfo['subfolders']+folderInfo['files']:
print (f['name'] + ' ' + f.get(‘type',''))
client.downloadFile(fileId, "/my/target/directory-or-file")
fileId = client.uploadFile("mypicture.jpg",folderInfo['id'],"@/my /file/location/mypicture.jpg")
…
107. … and even pure cURL shell script, for the braves :-)
# Get accessToken from refresh token
response=$(curl -X POST
-H 'Authorization:Basic '$AUTHORIZATION
-H 'Content-Type:application/x-www-form-urlencoded'
-d 'grant_type=refresh_token&refresh_token='$REFRESH_TOKEN
https://api.orange.com/oauth/v2/token)
if [[ $response =~ "error" ]]; then
echo $(date '+%T')' get accessToken error: '$response
exit -1
fi
accessToken=$(jsonValue $response access_token)
# Get $ESID (session ID)
response=$(curl -X POST
-H 'Authorization:Bearer '$accessToken
-H 'Content-Length:0'
https://api.orange.com/cloud/v1/session)
if [[ $response =~ "error" ]]; then
echo $(date '+%T')' get sessionId error: '$response
exit -1
fi
sessionID=$(jsonValue $response esid)
# Upload a file from current directory to the end-user's cloud
response=$(curl -k -S -X POST
-H 'X-Orange-CA-ESID: '$sessionID
-H 'Authorization: Bearer '$accessToken
-F 'description={"name":"'$FILE_NAME'","size":'$FILE_SIZE'}'
-F 'file=@'$FILE_NAME';filename='$FILE_NAME
https://cloudapi.orange.com/cloud/v1/files/content)
if [[ $response =~ "error" ]]; then
echo $(date '+%T')' file upload error: '$response
exit -1
fi
fileID=$(jsonValue $response fileId)
echo 'File successfully uploaded, with id: '$fileID
125. Orange Services
Mobile & web
apps
End-users
Partners
API
orangepartner.com
Why are
we doing
this?
At Orange, we used to develop our apps/services, eating our own cake.
126. Orange Services
Mobile & web
apps
End-users
Partners
API
orangepartner.com
We now enjoy sharing a much bigger cake with multiple partners/developers.
127. This is a virtuous circle for all: end-users, partners and Orange.
more usage & loyalty
more expertise & business
more possibilities & satisfaction
partners
end-users