【问题标题】:core_user_create_user and moodle webservice setup not workingcore_user_create_user 和 moodle 网络服务设置不工作
【发布时间】:2022-02-06 02:37:35
【问题描述】:

我已经完成了在我的 Moodle 3.11 实例上设置 Web 服务所需的一切,包括角色/功能/用户。但是发送测试请求总是给{ “异常”:“dml_missing_record_exception”, “错误代码”:“无效记录”, "message": "在数据库表 external_functions 中找不到数据记录。" }

访问它的 URL 格式为 https:///moodle/webservice/rest/server.php?wsfunction=core_user_create_user&service=mymoodleusermanage&moodlewsrestformat=json&users[0][username]=ABC&users[0][firstname]=VPTest&users [0][lastname]=None&users[0][email]=mail@xxx.com&users[0][password]=xxxxx&users[0][auth]=manual&wstoken=xxxxxxxxxxxxxx

服务参数正确设置为服务的短名称。除了站点管理->服务器->Web服务->外部服务->自定义服务之外,是否必须在其他任何地方定义服务

感谢您提供的任何帮助

【问题讨论】:

    标签: moodle moodle-api


    【解决方案1】:

    答案很简单 - 您正在尝试调用一个不存在的 Web 服务函数(因此出现有关无法在 external_functions 数据库表中找到该函数的数据库记录的错误消息。

    如果您查看 Moodle 代码:https://github.com/moodle/moodle/blob/master/lib/db/services.php#L1717,您会看到该函数名为 core_user_create_users - 末尾带有“s”。

    如果您将额外的“s”添加到您正在使用的 URL 参数中,那么它应该可以工作。

    【讨论】:

    • 非常感谢。这解决了问题。
    【解决方案2】:

    https:///moodle/webservice/rest/server.php?wsfunction=core_user_create_user&service=mymoodleusermanage&moodlewsrestformat=json&users[0][username]=ABC&users[0][firstname]=VPTest&users[0][lastname]=None&users[ 0][email]=mail@xxx.com&users[0][password]=xxxxx&users[0][auth]=manual&wstoken=xxxxxxxxxxxxxx

    您必须更改用户名全字符小写字母[用户名]=ABC 像这样[用户名]=abc 并添加 s wsfunction=core_user_create_users

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-18
      • 2010-10-18
      • 2016-06-08
      • 2015-11-19
      • 1970-01-01
      • 2021-09-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多