Created
December 17, 2014 14:47
-
-
Save kylejohnson/11aa102dfeb6f90fd42c to your computer and use it in GitHub Desktop.
This file contains 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
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” |
This file contains 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
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; | |
} | |
}); | |
}; | |
}); |
This file contains 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
{"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