Hi Ray.
Here is a server code example how can you use XHR to modify user:
pre
var responseBody = {},
requestParams = {},
paramKeys = request.keys();
for (var key = 0; key < paramKeys.length; key++) {
requestParams[paramKeys[key]] = request.get(paramKeys[key]);
}
var userObject = {"email": "hello@world.com"};
var xmlHTTPParameters = {
Code: Select all
"headers": {
//Your DB id.
"X-Appery-Database-Id": "52f32d06e4b0a25c11c89917",
//Your session token. You can only modify that user with whom logged in.
"X-Appery-Session-Token": "ba504062-403a-4c02-b6b5-f34123d1d8cb",
"Content-Type": "application/json"
},
"body": JSON.stringify(userObject)
};
//"53335c6ee4b07b0d80154c7e" - is user id.
var XHRResponse = XHR.send("PUT", "https://api.appery.io/rest/1/db/users/53335c6ee4b07b0d80154c7e", xmlHTTPParameters);
console.log(XHRResponse);
responseBody.requestBody = request.body();
responseBody.requestParams = requestParams;
response.success(XHRResponse, "application/json");
/pre
You can read about user editing here: http://docs.appery.io/documentation/b...
Here is about XHR in appery: http://docs.appery.io/documentation/b...
Also you can use this methods to work with users (more prefered):
http://docs.appery.io/documentation/b...