What are the requirements for submitting the contact form using JSON:API?
I enabled the core Contacts module and set up a custom site-wide contact form. I gave permission to anon + auth users to submit the form.
Next, I enabled JSON:API. I can see the contact form at /jsonapi/contact_form/contact_form
:
"data":[
{
"type":"contact_form--contact_form",
"id":"d97e73f1-7d06-4bf0-b05b-1c654a659dfc",
"links":{
"self":{
"href":"https://example.lndo.site/jsonapi/contact_form/contact_form/d97e73f1-7d06-4bf0-b05b-1c654a659dfc"
}
},
"langcode":"ja",
"status":true,
"dependencies":[
],
"drupal_internal__id":"example_support",
"label":"Example Support",
"recipients":[
"[email protected]"
],
"reply":"",
"weight":0,
"message":"Thank you for submitting.",
"redirect":""
}
],
But, what is the endpoint I need to POST to in order to submit this form?
I found this issue about emails not getting sent when a contact form is submitted via REST.
That issue suggests that the /entity/contact_message
REST endpoint must be enabled to submit the contact form-- is this also true for JSON:API?
I'm confused because using JSON:API, I can submit nodes without enabling any REST endpoints by POSTing to /jsonapi/node/content_type
.
Entity_type/Bundle
will cause creation of new entity of that bundle, so If that does not work then maybe it is related to json api module but I think enabling a rest endpoint shouldn't help in this situation