2

I just created the webform and added fields.

I need to create a Webform Submission Using Rest API POST method. I just installed Rest & Rest UI modules for this.

But when I try to test my API using API tester its showing the error like this :

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

But I have already determined the webform_id and here is my configuration

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

Headers :

Content-Type : application/json

POST Data :

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

Drupal Version : 8.6.4 Webform Module version : 8.x-5.1

Can anyone let me know Why its not working?

1
  • Did you try clear cache? Usually, if an install of the Rest is done after creating a content type error like this popup. It happens to me once when using REST API Post. The only difference, I was not using webform but add a content type the regular way (Drupal form component)
    – user93013
    Apr 11, 2019 at 16:36

2 Answers 2

6

Looking at the examples on the Webform REST project page, you should be using something like…

{
  "webform_id": "my_webform",
  "checkboxes_field": [
    "Option 3",
    "Option 5"
   ],
   "integer_field": 3,
   "radio_field": "Mail",
   "email": "[email protected]"
}
2

Don't forget to enable required services under /admin/config/services/rest:

  1. Enable REST resource "Webform Submit"
  2. Enable REST resource "Webform Elements"
  3. Enable REST resource "Webform Submission"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.