Php 使用microsoft graph分配许可证时出现问题
我的代码如下所示 错误 我犯了什么错?有两件事:Php 使用microsoft graph分配许可证时出现问题,php,microsoft-graph-api,Php,Microsoft Graph Api,我的代码如下所示 错误 我犯了什么错?有两件事: 这不是问题所在,但你为什么不使用 该方法的有效负载/正文需要2个数组参数-addLicenses和removeLicenses。我看不到第二个。如果只是添加许可证,请将removeLicenses设置为空数组 addLicenses数组是[disabledplan和skuId]的数组,而disabledplan本身就是一个数组。如果不想禁用任何计划,只需将其设置为空数组 希望这有帮助,两件事: 这不是问题所在,但你为什么不使用 该方法的有效负载
addLicenses
和removeLicenses
。我看不到第二个。如果只是添加许可证,请将removeLicenses
设置为空数组addLicenses
数组是[disabledplan
和skuId
]的数组,而disabledplan
本身就是一个数组。如果不想禁用任何计划,只需将其设置为空数组addLicenses
和removeLicenses
。我看不到第二个。如果只是添加许可证,请将removeLicenses
设置为空数组addLicenses
数组是[disabledplan
和skuId
]的数组,而disabledplan
本身就是一个数组。如果不想禁用任何计划,只需将其设置为空数组希望这有帮助,我按照你说的做了,`$datos=array(“addLicenses”=>array(array(“disabledPlans”=>array(),“skuId”=>$sku)),“removeLicenses”=>array())错误现在为404未找到,请求\u ResourceNotFound抱歉响应延迟。你能不能添加一个关于线路实际运行情况的跟踪(即REST调用)和完整的错误响应(即不仅404,还包括客户端请求id和时间戳)。我按照你说的做了,`$datos=array(“addLicenses”=>array(“disabledPlans”=>array(),“skuId”=>$sku)),“removeLicenses”=>array();`错误现在为404未找到,请求\u ResourceNotFound抱歉响应延迟。请您添加一条线路实际运行情况的跟踪(即REST调用)和完整的错误响应(即,不仅404,还包括客户端请求id和时间戳)。
$datos=array("addLicenses"=>array(array("skuId"=>$sku)));
$this->graph->setApiVersion("beta");
$this->crear("users/$id_user/assignLicense", $datos);
public function crear($objeto, $datos){
$r = $this->graph->createRequest("POST", "/$objeto")
->attachBody($datos)
->execute();
}
Type: GuzzleHttp\Exception\ClientException
Message: Client error: `POST
https://graph.microsoft.com/beta/users/USER_ID/assignLicense` resulted in a `400 Bad Request` response: {
"error": { "code": "Request_BadRequest", "message": "One or more parameters
of the function import 'assig (truncated...)
Filename: /var/www/html/ischooldesarrollo/application/libraries/msgraph-sdk-
php/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php
Line Number: 111