0

我已按照 API 文档插入组织单位,但收到“错误请求”错误。这是我的代码片段。

function orgUnitCreate() {
  var resource = {
    name: first+' '+init,
    parentOrgUnitPath: '/Students/'+unit,
    blockInheritance: false
  };
  
  AdminDirectory.Orgunits.insert(resource, "myCustomerID redacted for privacy");//This is the line throwing the error
}

谢谢您的帮助

编辑:我的客户 ID 确实有错误,谢谢

4

2 回答 2

0

此错误可能是由于

  • 未提供必填字段或参数。
  • 提供的值或提供的字段组合无效。

400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error

概括

如评论部分所述,此问题可能是由缺少/不正确的客户 ID 引起的。

参考

于 2020-12-14T11:06:22.137 回答
0
function orgUnitCreate() {
   var resource = {
       name: first+' '+init,
       parentOrgUnitPath: '/Students/'+unit,
       blockInheritance: false
   };
   try {
      resp= AdminDirectory.Orgunits.insert(resource, "my_customer"); 
   } catch (e) {
      resp = e; //Catch The error
   }
   Logger.log(resp);
}
于 2021-09-03T05:52:43.860 回答