A simple library that allows you to access the functions provided by the PersonAPI platform.
npm install personapi
var personapi = require('personapi');
personapi.init({
token: "your_user_token",
app_token: "your_app_token"
});
personapi.registerUser({
"email": "[email protected]",
"password": "user_password"
})
.then(function(response) {
console.log(response);
})
.catch(function(err) {
console.log(err);
});
- Login function - creates a new session for a user
personapi.login({
email: "[email protected]",
password: "user_password"
});
- Check session - checks if a user's session is still active
personapi.checkSession({
email: "[email protected]",
login_token": "token_received_after_login"
});
- Logout - destroys the current active session for a user
personapi.logout({
email: "[email protected]",
login_token": "token_received_after_login"
});
- Retrieve user details - queries the service for details of a user
personapi.getUserDetails({
email: "[email protected]",
login_token": "token_received_after_login"
});
- Update user details - overwrites user details
personapi.saveUserDetails({
email: "[email protected]",
login_token": "token_received_after_login",
first_name: "new first name",
surname: "new last name",
additional_details: {
address: "new address",
mobile: "new mobile"
}
});
- Update password - updates password of user
personapi.changePassword({
email: "[email protected]",
login_token": "token_received_after_login",
old_password: "old user password",
new_password: "new password"
});
- Get user list - returns list of users
personapi.getUserList({
email: "[email protected]",
login_token": "token_received_after_login"
});