Using App42 Push Notification – Backend as a Service
Posted on August 26, 2012 by Ajay Tiwari
String userName = "Nick"; String pwd = "********"; String emailId = "nick@gmail.com"; App42Callback requestCallback = this; /* This function used the App42Callback interface */ ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UserService userService = api.BuildUserService(); userService.CreateUser(userName,pwd,emailId,requestCallback); OnSucess(Object obj) { User user = (User) obj; String jsonResponse = user.ToString(); } public class CallBack : App42Callback { public override void OnSuccess(Object obj) { User user = (User) obj; //Do whatever you want with the object } public override void OnException(App42Exception e) { //Do whatever you want with the exception } }
String userName = "Nick"; String pwd = "********"; String emailId = "nick@gmail.com"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UserService userService = api.buildUserService(); User user = userService.createUser(userName, pwd, emailId); String jsonResponse = user.toString();
String userName = "Nick"; String pwd = "********"; String emailId = "nick@shephertz.com"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UserService userService = api.buildUserService(); User user = userService.createUser(userName, pwd, emailId); String jsonResponse = user.toString();
NSString *userName = @"Nick"; NSString *password = @"********"; NSString *emailId = @"nick@shephertz.com"; ServiceAPI *serviceAPIObj = [[ServiceAPI alloc]init]; serviceAPIObj.apiKey = @"<API_KEY>"; serviceAPIObj.secretKey = @"<SECRET_KEY>"; UserService *userService = [serviceAPIObj buildUserService]; User *user = [userService createUser:userName password:password emailAddress:emailId]; NSString *jsonResponse = [user toString];
String userName = "Nick"; String pwd = "********"; String emailId = "nick@shephertz.com"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UserService userService = api.buildUserService(); User user = userService.createUser(userName, pwd, emailId); String jsonResponse = user.toString();
String userName = "Nick"; String pwd = "********"; String emailId = "nick@shephertz.com"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UserService userService = api.BuildUserService(); User user = userService.CreateUser(userName, pwd, emailId); String jsonResponse = user.ToString();
uName = "Nick"; pwd = "********"; emailId = "nick@shephertz.com"; api = App42::ServiceAPI.new("<API_KEY>","<SECRET_KEY>"); userService = api.buildUserService(); user = userService.create_user(uName, pwd, emailId); jsonResponse = user.to_s();
The request format for create User is URL : https://api.shephertz.com/cloud/1.0/user Method : POST QueryParam : apiKey=<apiKey>&signature=<signature>&version=<version>×tamp=<UTC_FORMATED_TIME_STAMP> Accept : application/json Content-Type : application/json Body : {"app42":{"user":{"userName": "Nick","password": "******","email": "nick@shephertz.com"}}}
$userName = "Nick"; $pwd = "********"; $emailId = "nick@gmail.com"; $api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); $userService = $api->buildUserService(); $user = $userService->createUser($userName, $pwd, $emailId); $jsonResponse = $user->toString();
String userName = "Nick"; App42Callback requestCallback = this; /* This function used the App42Callback interface */ ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UserService userService = api.BuildUserService(); userService.GetUser(userName,requestCallback); OnSucess(Object obj) { User user = (User) obj; String jsonResponse = user.ToString(); } public class CallBack : App42Callback { public override void OnSuccess(Object obj) { User user = (User) obj; //Do whatever you want with the object } public override void OnException(App42Exception e) { //Do whatever you want with the exception } }
String userName = "Nick"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UserService userService = api.buildUserService(); User user = userService.getUser(userName); String jsonResponse = user.toString();
String userName = "Nick"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UserService userService = api.buildUserService(); User user = userService.getUser(userName); String jsonResponse = user.toString();
NSString *userName = @"Nick"; ServiceAPI *serviceAPIObj = [[ServiceAPI alloc]init]; serviceAPIObj.apiKey = @"<API_KEY>"; serviceAPIObj.secretKey = @"<SECRET_KEY>"; UserService *userService = [serviceAPIObj buildUserService]; User *user = [userService getUser:userName]; NSString *jsonResponse = [user toString];
String userName = "Nick"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UserService userService = api.buildUserService(); User user = userService.getUser(userName); String jsonResponse = user.toString();
String userName = "Nick"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UserService userService = api.BuildUserService(); User user = userService.GetUser(userName); String jsonResponse = user.ToString();
userName = "Nick"; api = App42::ServiceAPI.new("<API_KEY>","<SECRET_KEY>"); userService = api.buildUserService(); user = userService.get_user(userName); jsonResponse = user.to_s();
The request format for getUser is URL : https://api.shephertz.com/cloud/1.0/user/{userName} Method : GET QueryParam : apiKey=<apiKey>&signature=<signature>&version=<version>×tamp=<UTC_FORMATED_TIME_STAMP> Accept : application/json Content-Type : application/json
var user = new App42User(); // App42User supports User registration, retrieval, state management e.g. lock, delete and Authentication. var userName = "Nick"; // In order to use the various functions available under a particular API, a developer will have to call the // App42.initialize method by passing the apiKey and the secretKey. App42.initialize("<API_KEY>","<SECRET_KEY>"); user.getUser(userName,{ success: function(object) { // User Object creation }, error: function(error) { // User exception handled } });
$userName = "Nick"; $api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); $userService = $api->buildUserService(); $user = $userService->getUser($userName); $jsonResponse = $user->toString();