【问题标题】:Moodle Web Service responses with invalid_parameter_exception带有 invalid_parameter_exception 的 Moodle Web 服务响应
【发布时间】:2021-12-14 14:23:47
【问题描述】:

我使用 Docker 创建了 moodle 和 mariadb 容器。

Moodle:3.11.4

Mariadb:10.3

我正在尝试执行以下 web 服务:

客户:

wwwroot: 'http://localhost:8012',

服务:'moodle_mobile_app',

令牌:'8faf4879d2c654f11e404095032ae382',

严格SSL:真

致电: curl "http://localhost:8012/webservice/rest/server.php?wstoken=8faf4879d2c654f11e404095032ae382&moodlewsrestformat=json&wsfunction=core_user_get_users_by_field&moodlewsrestformat=json&id=2"

但出现以下错误: {"exception":"invalid_parameter_exception","errorcode":"invalidparameter", "message":"检测到无效的参数值(单个结构中缺少必需的键:字段)", "debuginfo":"单个结构中缺少必需的键:字段" }

我用moodle client for node也试过了

... client.call({ wsfunction: "core_user_get_users_by_field", method: "POST", args: { id: 2 } })... 但也收到同样的错误。 我检查了 API 文档,id 是这个的有效参数 网络服务。 你能帮忙吗?

【问题讨论】:

    标签: node.js docker-compose moodle-api moodle-mobile


    【解决方案1】:

    问题已解决

    client.call({
        method: "POST",
        wsfunction: "core_user_get_users_by_field",
        args: {
            field: "id",
            values: ["2"]
        }
    }).then(function(info) {
        var str = JSON.stringify(info, null, 4); 
        console.log(str);
    });
    

    【讨论】:

    • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 2016-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多