I would love submit submissions in webform utilizing core’s JSON:API. I’ve created a webform, then added Drupal Development fields I want. I’ve put in JSON:API Extras to give you the option customise some API properties per useful resource. I can create submissions, override Drupal Development distant tackle, submit Drupal Development referenced entity besides to Drupal Development subject values.
I’ve additionally tried a few information codecs, however nonetheless no luck.
Here is what I’ve accomplished to this point.
Headers
- api-key: 4bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- Content material-Kind: utility/vnd.api+json
- Settle for: utility/vnd.api+json
POST URL
http://instance.com.com/api/webform_submission/contact
POST information
{ "information": { "kind": "webform_submission--contact", "attributes": { "entity_type": "node", "entity_id": "5", "remote_addr": "", // Format 1 "e mail": "instance@instance.com", "title": [{"value": "Loremipsum"}], // Format 2 "information": [{ "email": "example@example.com", "message": ["Please ignore this email."], "title": [{"value": "Loremipsum"}], "topic": "Testing contact webform" }], // Format 3 "information": [{ "email": "example@example.com", "message": "Please ignore this email.", "name": "Loremipsum", "subject": "Testing contact webform" }] } } }
Outcomes
{ "jsonapi": { "model": "1.0", "meta": { "hyperlinks": { "self": { "href": "http://jsonapi.org/format/1.0/" } } } }, "information": { "kind": "webform_submission--contact", "id": "035de1b3-01ef-49a9-89ab-3bf8b2b641ea", "hyperlinks": { "self": { "href": "http://instance.com.com/api/webform_submission/contact/035de1b3-01ef-49a9-89ab-3bf8b2b641ea" } }, "attributes": { "serial": 211, "drupal_internal__sid": 62, "token": "xjIywCTtW9gqpgnYIAtVIIO_LpUB7pKIKnYfjIf1Z8U", "uri": "/api/webform_submission/contact", "created": "2020-11-05T01:26:51+00:00", "accomplished": "2020-11-05T01:26:51+00:00", "modified": "2020-11-05T01:26:51+00:00", "in_draft": false, "current_page": null, "remote_addr": null, "langcode": "en", "entity_type": "node", "entity_id": "5", "locked": false, "sticky": false, "notes": null }, "relationships": { "uid": { "information": null, "hyperlinks": { "self": { "href": "http://instance.com.com/api/webform_submission/contact/035de1b3-01ef-49a9-89ab-3bf8b2b641ea/relationships/uid" } } }, "webform_id": { "information": null, "hyperlinks": { "self": { "href": "http://instance.com.com/api/webform_submission/contact/035de1b3-01ef-49a9-89ab-3bf8b2b641ea/relationships/webform_id" } } } } }, "hyperlinks": { "self": { "href": "http://instance.com.com/api/webform_submission/contact" } } }
Drupal model: 9.x
Webform model: 6.0.0-alpha20
JSON:API Extras model: 8.x-3.16
Am I lacking one thing?