使用Rest API POST方法提交Web表单

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

我刚刚创建了网络表单并添加了字段。

我需要使用Rest API POST方法创建Webform提交。我刚刚为此安装了Rest&Rest UI模块。

但是当我尝试使用API​​测试器测试我的API时,它显示出这样的错误:

{"message":"Could not determine entity type bundle: \u0022webform_id\u0022 field is missing."}

但是我已经确定了webform_id,这是我的配置

POST URL:http://example.com/entity/webform_submission?_format=json

标题:

Content-Type:应用程序/ json

POST数据:

{
  "type": {
      "webform_id": "my_form"
    },
"your_mobile":[{"value":"123456789"}],
"your_name":[{"value":"Test"}],
"your_email":[{"value":"[email protected]"}]
}

Drupal版本:8.6.4其余UI版本:8.x-1.16Webform模块版本:8.x-5.1

为什么它不起作用?

rest drupal-8 drupal-webform
1个回答
0
投票

我认为您的JSON结构错误。这是一个对我有用的例子:

{
    "webform_id": "contact"
}
© www.soinside.com 2019 - 2024. All rights reserved.