You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GraphQL请求报错:未提供必填变量$input(AccountBindBankCardInput!类型)

问题原因与解决办法

错误原因

  1. Payload结构不符合GraphQL规范:GraphQL请求的变量必须放在variables字段下,你直接将input作为顶层键,导致服务端无法识别这是查询中声明的$input变量。
  2. Input格式错误:你把input的值写成了GraphQL语法的字符串,而非标准JSON对象,服务端无法将其解析为AccountBindBankCardInput类型。

解决办法

修改Payload的结构和input的格式,将变量放入variables字段,并使用标准JSON对象定义input内容:

payload = {
    "operationName": "CreateBinding",
    "variables": {
        "input": {
            "lang": "ru",
            "domainSfx": "ru",
            "templateTag": "desktop/form",
            "returnPath": "https://id.yandex.ru/pay",
            "regionId": 1
        }
    },
    "query": "mutation CreateBinding($input: AccountBindBankCardInput!) {\n  accountBindBankCard(input: $input) {\n    status\n    url\n    __typename\n  }\n}"
}

关键修改点

  • 新增variables字段,将input嵌套其中,与查询中的$input变量对应。
  • 将input的值从GraphQL语法字符串改为标准JSON对象(键名用双引号,无需整体包裹引号),确保服务端能正确解析为要求的AccountBindBankCardInput类型。

内容的提问来源于stack exchange,提问作者Trollface

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.04 13:01:55