13. B2B2C example, at the gym
> >
Marco
GymTech CTO
develops & manages
solutions for multiple
gym clubs
Peter
Gym customer
expects the best
experience, with relevant
interactions & privacy
Jim
Gym manager
wants to boost his
business & know his
customers better
27. new devices or pure S/W add-ons
< /></>
C, Java, etc.etc.
28. Orange
Datavenue
APIs
Marco,
GymTech CTO
Datavenue portal
Access API
GymTech’s platforms
GymTech’s 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
41. Orange
Cloud
Uploader
#!/bin/bash
# OrangeCloud_uploader.sh
# …
CLIENT_ID="gVZ0rd4zQDQ..a.dbP0iuWF"
CLIENT_SECRET="R6zYmsIEgtSIMWIA"
AUTHORIZATION=$(encodeBase64 $CLIENT_ID':'$CLIENT_SECRET)
REFRESH_TOKEN="OFR-d8e439…92a1f7e4a7e1b9c812ba"
# File to upload
FILE_NAME="weather.png"
FILE_SIZE=$(stat -f%z « $FILE_NAME")
# [1] Obtain 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)
42. Orange
Cloud
Uploader
# [2] 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)
# [3] Upload a file from current directory to 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
43. Orange
Cloud
SDK
// 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];
}
44. // 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");
}];
}
Orange
Cloud
SDK