# Graph Ql

Please setup the Graph Ql extension at here: <https://github.com/landofcoder/module-product-label-graph-ql>

Or setup via composer by run commands:

```
composer require landofcoder/module-productlabel-graphql
php bin/magento module:enable Lof_ProductLabelGraphQl
php bin/magento setup:upgrade --keep-generated
php bin/magento cache:clean
```

**Query**

Get Form design by Id

```
query {
    lofFormBuilderFormById (form_id: Int!) {
        title
        identifier
        show_captcha
        show_toplink
        submit_button_text
        redirect_link
        creation_time
        before_form_content
        after_form_content
        success_message
        page_title
        meta_keywords
        meta_description
        submit_text_color
        submit_background_color
        submit_hover_color
        input_hover_color
        tags
        design_fields {
            cid
            field_id
            label
            field_type
            required
            field_options
            fieldcol
            wrappercol
            inline_css
            field_size
            font_weight
            color_text
            font_size
            color_label
            validation
            include_blank_option
            options {
                label
                checked
            }
        }
        stores
    }
}
```

Get list public form profiles

```
{
  lofFormBuilderFormList(filter: {}, pageSize: 5) {
    items {
        form_id
        title
        identifier
        show_toplink
        creation_time
        page_title
        tags
    }
    total_count
    page_info {
      page_size
      current_page
      total_pages
    }
  }
}}
```

Get my submitted messages list

```
{
  lofFormBuilderMessageList (filter: {}, pageSize: 10, currentPage: 1) {
    items {
      message_id
      form_id
      product_id
      subject
      email_from
      creation_time
      message
      
    }
    total_count
    page_info {
      page_size
      current_page
      total_pages
    }
  }
}
```

Get my submitted message by ID

```
{
  lofFormBuilderMessage (message_id: Int!) {
    message_id
    form_id
    product_id
    subject
    email_from
    creation_time
    message
  }
}
```

POST form data - required customer logged in

```
mutation {
  lofFormbuilderSubmit(
    input: {
      form_id: 2
      product_id: 0
      captcha: ""
      fields: [
        {
          cid: "name"
          field_name: "loffield_name2"
          value: "test name from api"
        }
        {
          cid: "email"
          field_name: "loffield_email2"
          value: "testapi@gmail.com"
        }
        { cid: 
          "phone"
          field_name: "loffield_phone2"
          value: "01243655555" 
        }
        {
          cid: "content"
          field_name: "loffield_content2"
          value: "test content from api"
        }
        { 
          cid: "age" 
          field_name: "loffield_age2"
          value: "Yes" 
        }
        { 
          cid: "c5"
          field_name: "loffield_c52"
          value: "" 
        }
        { 
          cid: "agreement"
          field_name: "loffield_agreement2"
          value: "Yes" 
        }
      ]
    }
  )
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://landofcoder.gitbook.io/magento-2-formbuilder/graph-ql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
