GraphQL
WebForms GraphQL allows deep integration with custom frontend and 3rd party software.
Queries
webformsForm
Get all available form information such as name, code, description texts, configuration options, fields and fieldsets.
Accepted parameters
Parameter | Description |
---|---|
form_id | Form ID number you can see on Manage Forms page. |
Form fields
Field | Description |
---|---|
form_id | Form ID. |
name | Form name. |
code | Form code. |
redirect_url | The url which you are redirected after submission. |
description | Form description text. |
success_text | Form success text. |
below_text | Text below the form. |
submit_button_text | Text on the submit button. |
files_upload_limit | File upload limit in kb. |
images_upload_limit | Images upload limit in kb. |
is_url_parameters_accepted | Accept url parameters. |
url_key | Url key of the form. |
meta_keywords | Meta keywords. |
meta_description | Meta description. |
meta_title | Meta title. |
fieldsets | Fieldsets* list. |
*Fieldset fields
Field | Description |
---|---|
fieldset_id | Fieldset ID. |
name | Fieldset name. |
fields | Fields* list. |
*Field fields
Field | Description |
---|---|
field_id | Field ID. |
form_id | Form ID. |
fieldset_id | Fieldset ID. |
name | Field name. |
type | Field type. |
code | Field code. |
result_label | Result label. |
comment | Comment. |
type_attributes_serialized | Field type attributes. |
is_required | Is required. |
validation_required_message | Error text to display for required fields. |
position | Field position. |
is_active | Is active. |
is_label_hidden | Hide field label in the form. |
custom_attributes | Custom attributes. |
width_proportion_lg | Width for large screen. |
width_proportion_md | Width for medium screen. |
width_proportion_sm | Width for small screen. |
is_displayed_in_new_row_lg | Start new row with this field (large screen). |
is_displayed_in_new_row_md | Start new row with this field (medium screen). |
is_displayed_in_new_row_sm | Start new row with this field (small screen). |
css_container_class | Css class for container. |
css_input_class | Css class for input. |
css_input_style | Css style for input. |
display_in_result | Display field in result. |
browser_autocomplete | Autocomplete attribute value. |
is_unique | Unique validation is applied. |
unique_validation_message | Unique validation failed message. |
min_length | Minimum input length. |
min_length_validation_message | Minimum input length validation failed message. |
max_length | Maximum input length. |
max_length_validation_message | Maximum input length validation failed message. |
regex_validation_pattern | Regular expression validation. |
regex_validation_message | Regular expression validation failed message. |
Query example:
query {
webformsForm(form_id: 111) {
form_id
name
code
description
below_text
success_text
is_survey
submit_button_text
url_key
meta_title
meta_keywords
meta_description
fieldsets {
fieldset_id
name
fields {
name
type
code
comment
type_attributes_serialized
is_required
validation_required_message
position
is_label_hidden
}
}
}
}
webformsResults
Depending on your access permissions you may get the results list for specified form. If you are logged in under admin account the access is regulated in the ACL backend section.
If you are logged in as a customer you may be able to get your results depending on the form Customer Access Settings.
Accepted parameters
Parameter | Description |
---|---|
filter | Filter parameters for results list. Accepted filter parameters: result_id and form_id. |
Result list fields
Field | Description |
---|---|
items | List of results*. |
*Result fields
Field | Description |
---|---|
result_id | Result ID. |
form_id | Form ID. |
store_id | Store ID. |
customer_id | Customer ID. |
approved | Approved status. |
created_at | Created time. |
updated_at | Updated time. |
submitted_from_serialized | The page information. |
submitted_from_serialized | Referrer page url. |
fields | Result data fields* list. |
Query example:
query {
webformsResults(filter:{
form_id:111
}) {
items{
store_id
created_at
fields{
field_id
code
value
}
}
}
}
Mutations
webformsSubmitForm
You can submit any custom data you would like to collect. Please use Hidden fields to store extra information with the submission.
Accepted parameters
Parameter | Description |
---|---|
form_id | Form ID number you can see on Manage Forms page. |
formData | The data you would like to submit in JSON format. |
Mutation example:
mutation {
webformsSubmitForm(
form_id: 129
formData: "{\"field\":{\"810\":\"John\",\"811\":\"Doe\",\"812\":\"john@doe.com\"},\"g-recaptcha-response\":\"03AGdBq24kyYcswcnSqN5KAF2Vr8IJFVlsBJ8gRFJqdLn_gVip-ctQ62dwIl5QxypwvmA4CPSx2_SXun9-TkfTydG-7SnzepOOFGEJD4HA7U61f-u8MMdTiQye0KkdM2AWgAMCACpDFA4jbD2FIY0tg6aczyx_J2d46V7AAd-FcEGFiJ4_OW54utJWXg3etqgsvkGlUqYLMjtmMtuHrHgYCXIel061FOF2XXvi8yVRKzhD_DTrypN565uLnUiR6ht0fk_umbd0wR2Q3ZXWWSC2Zn-Xw9xKLE4Ks2C8-d3R5DQLw2dMaUgxZ4B0eMyJfxRlZYHXVWPFbSvWtDM-DntnqRxlewlxpasaAVJLX44FPCJ3NVxYwebAf0VE42Yw1n7_UPlwTmf104l8pDWsi51fuLGKPPKmiz6ADrRUeUCKCcZ_EfPKApRsil8\"}"
) {
success
errors
result
}
}
webformsRecaptcha
Validate reCAPTCHA for the whole customer session. Use the validation if you need to upload customer files.
Please send the reCAPTCHA response in the X-ReCaptcha header.
Example:
mutation{
webformsRecaptcha
}
webformsUpload
Upload files to the WebForms dropzone. Use obtained hashes to save with the result using webformsSubmitForm mutation.
Please enable Dropzone for the upload field, otherwise the upload will be rejected.
The upload is always protected with the reCAPTCHA. Please use webformsRecaptcha mutation before uploading.
Accepted parameters
Parameter | Description |
---|---|
field_id | Field ID. |
filename | File name. |
content | The content of the file in base64 encoding. |
mimeType | Mime type(optional). |
Example:
mutation {
webformsUpload(
field_id: 811
filename: "sSSsDDsas.txt"
content: "data:text/plain;base64,YXNkYXNkYXNkDQpzYWRhc2tkamFza2xkaiANCmFzZGphc2xrZGphc2xrZA0Kc2tsZGZqc2RsDQpsc2Rma2pzZGxmaw=="
)
}
Response example:
{
"data": {
"webformsUpload": "MdlsTNwHTiojPuRS8kr8RvmIHNMyUhdpFLHTASSU"
}
}
Example of submitting the uploaded file:
mutation {
webformsSubmitForm(
form_id: 130
formData: "{\"field\":{\"811\":\"MdlsTNwHTiojPuRS8kr8RvmIHNMyUhdpFLHTASSU\"}}"
) {
success
errors
result
}
}