使用Rest API POST方法提交Webform

时间:2019-01-05 11:30:24

标签: rest drupal-8 drupal-webform

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

我需要使用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":"test@gmail.com"}]
}

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

为什么它不起作用?

1 个答案:

答案 0 :(得分:0)

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

{
    "webform_id": "contact"
}
相关问题