2
我的應用程序使用外部API創建owncloud用戶。如何在自己的雲中創建使用外部API的用戶
我嘗試使用外部API獲取owncloud版本。下面是我使用的代碼:
$.ajax({
type: 'GET',
url: 'http://localhost/owncloud/index.php/apps/news/api/2.0/version',
contentType: 'application/json',
success: function (response) {
// handle success
},
error: function() {
// handle errors
},
beforeSend: function (xhr) {
var username = 'admin';
var password = 'admin';
var auth = btoa(username + ':' + password);
xhr.setRequestHeader('Authorization', 'Basic ' + auth);
}
});
上面的代碼沒有工作。
如何實現這一目標?
在此先感謝。