“检测到无效参数值”moodle

问题描述 投票:0回答:1

我在postman中通过xlsx文件执行批量上传时遇到这个问题。当我通过curl运行Web服务时遇到问题:

object(stdClass)#291 (4) { ["exception"]=> string(27) "invalid_parameter_exception" ["errorcode"]=> string(16) "invalidparameter" ["message"]=> string(32) "Invalid parameter value detected" ["debuginfo"]=> string(93) "users => Invalid parameter value detected: Missing required key in single structure: username" }

我发送一个数组如下:

array(1) {
  ["users"]=>
  array(1) {
    [0]=>
    array(1) {
      ["users"]=>
      array(1) {
        [0]=>
        array(6) {
          ["username"]=>
          string(11) "userprueba"
          ["password"]=>
          string(10) "TestPass1!"
          ["firstname"]=>
          string(4) "PEPE"
          ["lastname"]=>
          string(8) "RUBIALES"
          ["idnumber"]=>
          string(10) "3601611842"
          ["email"]=>
          string(17) "[email protected]"
        }
      }
    }
  }

我已经查看了网站政策,并正在相应地提交数据。然而问题仍然存在。我怀疑问题出在数组的发送方式上,但我还没有找到解决方案。

感谢您的帮助,谢谢!

php moodle
1个回答
0
投票

您使用哪种网络服务?是

core_user_update_users
吗?

您可以在 Moodle 中查看数组结构:

站点管理 > 服务器 > Web 服务 > API 文档 > core_user_create_users

例如:

[users] =>
    Array 
        (
        [0] =>
            Array 
                (
                [username] => string                
                [auth] => string                
                [password] => string                
                [firstname] => string                
                [lastname] => string                
                [email] => string                
                [idnumber] => string                
                )
        )

看起来你有 2 个

[users]
数组,应该只有一个

array(1) {
  ["users"]=>
  array(1) {
    [0]=>
    array(1) {
      ["users"]=>
      array(1) {
© www.soinside.com 2019 - 2024. All rights reserved.