first, the example provided in the OwnCloud documentation is not complete. It is suggested that you use curl or another command line utility. I got this script to work using jQuery AJAX:
<script> function doMake() { $.ajax({ type: 'POST', url: 'http://myowncloud.local:8080/ocs/v1.php/cloud/users', data: {'userid':'test', 'password':'test'}, crossDomain: true, beforeSend: function(xhr) { xhr.setRequestHeader('Authorization', 'Basic ' + window.btoa(unescape(encodeURIComponent('owncloud-dev' + ':' + 'password')))) } }).done( function(data, status, xhr) { document.write(status); }).fail( function(xhr, status, error) { document.write(status + ":" + error); }); } </script>
save the above as adduser.html in your root directory of your own keyboard. replace the username / password of the administrator in the RequestHeader authorization.
source share