Kuali GraphQL Documentation

Guides

Get the schema for a form

You can query the GraphQL API to get field definitions for a form.


Overview

Using a GraphQL query you can get the current published version of an app's schema. The data you'll find will include the app id, formKeys, and labels.

Step 1: Get the id for the form's app

You'll need the id of the form's app in order to get it's schema.

Query

      
        query {
  apps {
    id
    name
  }
}

      
    

Results

            
              {
                "data": {
                  "apps": [
                    {
                      "id": "5d5f337395a039001e48a649",
                      "name": "Incomplete Grade Request"
                    },
                    {
                      "id": "5ac835643d7f3600196b2749",
                      "name": "Parking Tag Application"
                    },
                    {
                      "id": "5e6715e208f295001f8219b6",
                      "name": "Travel Disclosure"
                    },
                  ]
                }
              }
            
          

Step 2: Query the form's schema

Note how the formKey attribute provides the unique identifier for each field. The label attribute is the label that appears on the form for that field.

Query

      
        query ($id: ID) {
  app(id: $id) {
    id
    formVersion {
      schema {
        formKey
        label
      }
    }
  }
}

      
    

Variables

            
{"id":"5ac835643d7f3600196b2749"}
            
          

Results

            
              {
                "data": {
                  "app": {
                    "id": "5ac835643d7f3600196b2749",
                    "formVersion": {
                      "schema": [
                        {
                          "formKey": "data.2JzrEICFX1",
                          "label": "Name"
                        },
                        {
                          "formKey": "data.RmAnxiNTnj",
                          "label": "Vehicle Make"
                        },
                        {
                          "formKey": "data.ib_QUsLdUO",
                          "label": "Vehicle Model"
                        },
                        {
                          "formKey": "data.nYMA37CRlj",
                          "label": "Vehicle Color"
                        },
                        {
                          "formKey": "data.FgdlaBSgn-",
                          "label": "License Plate"
                        },
                        {
                          "formKey": "meta.submittedBy",
                          "label": "Submitter"
                        },
                        {
                          "formKey": "meta.submittedBy.id",
                          "label": "Submitter - ID"
                        },
                        {
                          "formKey": "meta.submittedBy.displayName",
                          "label": "Submitter - Display Name"
                        },
                        {
                          "formKey": "meta.submittedBy.schoolId",
                          "label": "Submitter - School ID"
                        },
                        {
                          "formKey": "meta.submittedBy.email",
                          "label": "Submitter - Email"
                        },
                        {
                          "formKey": "meta.submittedBy.username",
                          "label": "Submitter - Username"
                        },
                        {
                          "formKey": "meta.submittedAt",
                          "label": "Submitted At"
                        },
                        {
                          "formKey": "meta.createdBy",
                          "label": "Created By"
                        },
                        {
                          "formKey": "meta.createdBy.id",
                          "label": "Created By - ID"
                        },
                        {
                          "formKey": "meta.createdBy.displayName",
                          "label": "Created By - Display Name"
                        },
                        {
                          "formKey": "meta.createdBy.schoolId",
                          "label": "Created By - School ID"
                        },
                        {
                          "formKey": "meta.createdBy.email",
                          "label": "Created By - Email"
                        },
                        {
                          "formKey": "meta.createdBy.username",
                          "label": "Created By - Username"
                        },
                        {
                          "formKey": "meta.createdAt",
                          "label": "Created At"
                        },
                        {
                          "formKey": "meta.serialNumber",
                          "label": "Number"
                        },
                        {
                          "formKey": "meta.link",
                          "label": "Link to Document"
                        },
                        {
                          "formKey": "meta.workflowTotalRuntime",
                          "label": "Workflow Total Run Time"
                        },
                        {
                          "formKey": "meta.workflowStatus",
                          "label": "Workflow Status"
                        },
                        {
                          "formKey": "meta.currentWorkflowSteps",
                          "label": "Time on Current Step"
                        }
                      ]
                    }
                  }
                }
              }