Create user on Owncloud -
i searched, not find correct way create new users on owncloud server. tried apply user provisioning api says, response:
<ocs> <meta> <status>failed</status> <statuscode>999</statuscode> <message>invalid query, please check syntax. api specifications here: http://www.freedesktop.org/wiki/specifications/open-collaboration-services. debug output: debug output: http request method: post http request uri: /owncloud/ocs/v1.php/cloud/users%20-d%20userid=%22frank%22%20-d%20password=%22frankspassword%22</message> </meta> </ocs>
my http post is:
http://myuser:mypassword@ip_owncloud_server/owncloud/ocs/v1.php/cloud/users -d userid="frank" -d password="frankspassword"
what wrong here?
first, example given in owncloud documentation not complete. assumes you're using curl or other command line utility. got script 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 above adduser.html in root of owncloud installed directory. replace admin username/password in authorization requestheader.
Comments
Post a Comment