我正在使用apache api公开会议。它一直在登录中工作,但是当我尝试添加新用户时,我收到HTTP响应错误500(权限不足(。
我试过这个,但它不起作用:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
function create_user() {
$.ajax({
method: "POST",
url: "http://localhost:5080/openmeetings/services/user",
data: {sid : "2575fb6f-c030-4ef4-b9c5-0c6bcb9b18f3",
userDTO:JSON.stringify( { address :{
additionalname:"mr"
,comment:"k"
,country:"sy"
,deleted:false
,email:"ssss@hotmail.com"
,fax:"111"
,id:222
,inserted:"2014-02-14T08:00Z"
,phone:"1111"
,street:"sss"
,town:"sss"
,updated:"2014-02-14T08:00Z"
,zip:"qq"
}
,externalId:"1"
,externalType:"myCMS"
,firstname:"asasas"
,id:1
,languageId:55
,lastname:"zxczxc"
,login:"asasas"
,password:"asasas"
,rights:null
,timeZoneId:"sa"
,type:{type:"user"}
}),
confirm: false },
dataType: "json",
success: function(data){
$("#res").html(data["id"]);
}
});
}
$(document).ready(function(){
$("button").click(function(){
create_user();
});
});
</script>
</head>
<body>
<button>Get JSON data</button>
<div id="res"></div>
</body>
</html>
应将 SID 作为 URL 本身的一部分传递。这将解决权限问题。