Created
September 1, 2015 21:49
-
-
Save boomtrain-support/6c9c020c27832e231dcc to your computer and use it in GitHub Desktop.
PUT /person - Updating an existing User using jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// Update an existing User | |
function putPersonUpdate() { | |
// JSON stringify the User data | |
var json_user = JSON.stringify({ | |
"bsin":"{Existing User's BSIN}", | |
"email":"{OR Existing User's Email Address}", | |
"app_member_id":"{OR Your Unique ID for the User}", | |
"firstName":"{First Name}", | |
"lastName":"{Last Name}", | |
"attributes":[ | |
{ | |
"op":"replace", | |
"name":"{Attribute 1}", | |
"value":"{Value}" | |
}, | |
{ | |
"op":"delete", | |
"name":"{Attribute 2}", | |
"value":"{value}" | |
}, | |
... | |
] | |
}); | |
// Send a jQuery AJAX request to retrieve the User | |
$.ajax({ | |
url: 'https://api.boomtrain.com/person', | |
// Replace with your Username, Password, and App Id | |
headers: { | |
'x-app-id': '{app_id}', | |
'Content-Type': 'application/json', | |
'Authorization': 'Basic ' + btoa('{username}:{password}') | |
}, | |
type: 'PUT', | |
data: json_user, | |
success: function(msg) { | |
console.log(msg); | |
} | |
}); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment