Last active
December 30, 2015 09:18
-
-
Save mdobson/7808028 to your computer and use it in GitHub Desktop.
Updating an entity in Apigee
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<meta name="apple-mobile-web-app-status-bar-style" content="black"> | |
<title>Museums</title> | |
<script src="js/apigee.js"></script> | |
<script> | |
//Initialize Client | |
var apigee = new Apigee.Client({ | |
orgName:"mdobson", | |
appName:"sandbox" | |
}); | |
//Entity search options | |
var options = { | |
'type':'cats', | |
'name':'alvin' | |
}; | |
//Retrieve our enitity | |
apigee.getEntity(options, function(error, entity) { | |
if(error) { | |
console.log(arguments); | |
} else { | |
//Set some property on the entity | |
entity.set("nickname","alvy"); | |
//Save entity | |
entity.save(); | |
} | |
}); | |
//Uncomment to add data to your store! | |
// museum = {"museum":"Detroit Institute of Art"}; | |
// museums.addEntity(museum, function(error, response) { | |
// if (error) { alert("write failed"); } | |
// else { alert("succeeded!"); } | |
// }); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment