Skip to main content

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

ParameterDescription
form_idForm ID number you can see on Manage Forms page.

Form fields

FieldDescription
form_idForm ID.
nameForm name.
codeForm code.
redirect_urlThe url which you are redirected after submission.
descriptionForm description text.
success_textForm success text.
below_textText below the form.
submit_button_textText on the submit button.
files_upload_limitFile upload limit in kb.
images_upload_limitImages upload limit in kb.
is_url_parameters_acceptedAccept url parameters.
url_keyUrl key of the form.
meta_keywordsMeta keywords.
meta_descriptionMeta description.
meta_titleMeta title.
fieldsetsFieldsets* list.

*Fieldset fields

FieldDescription
fieldset_idFieldset ID.
nameFieldset name.
fieldsFields* list.

*Field fields

FieldDescription
field_idField ID.
form_idForm ID.
fieldset_idFieldset ID.
nameField name.
typeField type.
codeField code.
result_labelResult label.
commentComment.
type_attributes_serializedField type attributes.
is_requiredIs required.
validation_required_messageError text to display for required fields.
positionField position.
is_activeIs active.
is_label_hiddenHide field label in the form.
custom_attributesCustom attributes.
width_proportion_lgWidth for large screen.
width_proportion_mdWidth for medium screen.
width_proportion_smWidth for small screen.
is_displayed_in_new_row_lgStart new row with this field (large screen).
is_displayed_in_new_row_mdStart new row with this field (medium screen).
is_displayed_in_new_row_smStart new row with this field (small screen).
css_container_classCss class for container.
css_input_classCss class for input.
css_input_styleCss style for input.
display_in_resultDisplay field in result.
browser_autocompleteAutocomplete attribute value.
is_uniqueUnique validation is applied.
unique_validation_messageUnique validation failed message.
min_lengthMinimum input length.
min_length_validation_messageMinimum input length validation failed message.
max_lengthMaximum input length.
max_length_validation_messageMaximum input length validation failed message.
regex_validation_patternRegular expression validation.
regex_validation_messageRegular 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

ParameterDescription
filterFilter parameters for results list. Accepted filter parameters: result_id and form_id.

Result list fields

FieldDescription
itemsList of results*.

*Result fields

FieldDescription
result_idResult ID.
form_idForm ID.
store_idStore ID.
customer_idCustomer ID.
approvedApproved status.
created_atCreated time.
updated_atUpdated time.
submitted_from_serializedThe page information.
submitted_from_serializedReferrer page url.
fieldsResult 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

ParameterDescription
form_idForm ID number you can see on Manage Forms page.
formDataThe 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.

warning

Please enable Dropzone for the upload field, otherwise the upload will be rejected.

warning

The upload is always protected with the reCAPTCHA. Please use webformsRecaptcha mutation before uploading.

Accepted parameters

ParameterDescription
field_idField ID.
filenameFile name.
contentThe content of the file in base64 encoding.
mimeTypeMime 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
}
}