Skip to content

Instantly share code, notes, and snippets.

@kylejohnson
Created December 17, 2014 14:47
Show Gist options
  • Save kylejohnson/11aa102dfeb6f90fd42c to your computer and use it in GitHub Desktop.
Save kylejohnson/11aa102dfeb6f90fd42c to your computer and use it in GitHub Desktop.
curl -XPOST http://zmdevapi/monitors.js -d "Monitor[Name]=Cliff-Burton \&Monitor[Function]=Modect \ &Monitor[Protocol]=http \ &Monitor[Method]=simple \&Monitor[Host]=ussr:pass@192.168.11.20 \ &Monitor[Port]=80 \ &Monitor[Path]=/mjpg/video.mjpg\ &Monitor[Width]=704 \ &Monitor[Height]=480 \ &Monitor[Colours]=4”
ZoneMinder.controller('MonitorController', function($scope, $http) {
$scope.monitor = {};
$scope.submitMonitor = function() {
$http({
method : 'POST',
url : '/api/monitors.json',
data : $scope.monitor,
headers : { 'Content-Type': 'application/x-www-form-urlencoded' } // set the headers so angular passing info as form data (not request payload)
})
.success(function(data) {
console.log(data);
if (!data.success) {
// if not successful, bind errors to error variables
$scope.errorName = data.errors.name;
$scope.errorSuperhero = data.errors.superheroAlias;
} else {
// if successful, bind success message to message
$scope.message = data.message;
}
});
};
});
{"sourceType":"Remote","RefBlendPerc":6,"AlarmRefBlendPerc":6,"Function":"Monitor","Name":"Cliff-Burton","Colours":"4","Width":1920,"Height":1080,"Protocol":"http","Method":"simple","Host":"1.2.3.4","Port":80,"Path":"/some/path.jpg"}:""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment