Kuali GraphQL Documentation

Guides

Get documents

Search, filter and sort documents of an app.


Jump to a query
Recent approvals Stalled approvals Text searching

Overview

The GraphQL API provides rich search, filter and sort capabilities to enable you to retrieve documents for a variety of needs. We provide multiple use cases here.

Recent approvals

After documents are approved, you may want to automatically sync data from the completed documents into another system. To do this you'll need to retrieve the approved documents that were approved most recently.

Requirements

  • Filter for approved documents
  • Filter for documents changed since a given date.

Variables

Variables are used to filter and sort the results. These variables do three things:

  • Sort by the updatedAt field which is part of the document's meta data.
  • Includes documents where worflowStatus is Complete. That's the state of fully approved documents.
  • Include documents where updatedAt is after Sat Feb 11 2023 07:00:00 GMT+0000. Note how dates are always set with a Unix time stamp in milliseconds.
            
{
  "appId": "5f6a352488cf8c6265478e3d",
  "skip": 0,
  "limit": 25,
  "sort": [
    "meta.updatedAt"
  ],
  "query": "",
  "fields": {
    "type": "AND",
    "operators": [
      {
        "field": "meta.workflowStatus",
        "type": "IS",
        "value": "Complete"
      },
      {
        "field": "meta.updatedAt",
        "type": "RANGE",
        "min": "1676098800000"
      }
    ]
  }
}

            
          

Query

      
        query (
  $appId: ID!
  $skip: Int!
  $limit: Int!
  $sort: [String!]
  $query: String
  $fields: Operator
) {
  app(id: $appId) {
    id
    name
    documentConnection(
      args: {
        skip: $skip
        limit: $limit
        sort: $sort
        query: $query
        fields: $fields
      }
      keyBy: ID
    ) {
      totalCount
      edges {
        node {
          id
          data
          meta
        }
      }
      pageInfo {
        hasNextPage
        hasPreviousPage
        skip
        limit
      }
    }
  }
}

      
    

Results

            
              {
                "data": {
                  "app": {
                    "id": "5f6a352488cf8c6265478e3d",
                    "name": "Travel Request",
                    "documentConnection": {
                      "totalCount": 5,
                      "edges": [
                        {
                          "node": {
                            "id": "5f6a389d77d701400f543a29",
                            "data": {
                              "kdVAKMFR3g": {
                                "id": "5f6a2c933b89c10014407263",
                                "label": "Pat Jensen",
                                "displayName": "Pat Jensen",
                                "username": "31824387",
                                "email": "pat.jensen@kies.edu",
                                "schoolId": null
                              },
                              "3vawXskL7A": {
                                "id": "5f6a2c933b89c10014407263",
                                "displayName": "Pat Jensen",
                                "email": "pat.jensen@kies.edu",
                                "username": "31824387",
                                "schoolId": null,
                                "label": "Pat Jensen"
                              },
                              "qSI30f4foU": {
                                "id": "5e2f5758482f6e0017e30e57",
                                "label": "History"
                              },
                              "qLPw3UsIqq": "San Diego",
                              "KB7OqX4jVM": 1601251200000,
                              "z2g54Ogo9j": 1601596800000,
                              "oK8Q-r4o_d": "Conference",
                              "WCOEDKseRC": 205000
                            },
                            "meta": {
                              "createdBy": {
                                "id": "5f6a2c933b89c10014407263",
                                "displayName": "Pat Jensen",
                                "username": "31824387",
                                "email": "pat.jensen@kies.edu",
                                "schoolId": "1",
                                "firstName": "Pat",
                                "lastName": "Jensen",
                                "label": "Pat Jensen"
                              },
                              "submittedBy": {
                                "id": "5f6a2c933b89c10014407263",
                                "displayName": "Pat Jensen",
                                "username": "31824387",
                                "email": "pat.jensen@kies.edu",
                                "schoolId": "1",
                                "firstName": "Pat",
                                "lastName": "Jensen",
                                "label": "Pat Jensen"
                              },
                              "createdAt": "2020-09-22T17:47:09.948Z",
                              "serialNumber": "0001",
                              "appPublishVersion": 1,
                              "simulation": {
                                "applicationId": "5f6a352488cf8c6265478e3d",
                                "associatedDocumentIds": [
                                  "5f6a389d77d701400f543a29"
                                ],
                                "complete": true,
                                "steps": [
                                  {
                                    "completedAt": "2020-09-22T17:47:54.155Z",
                                    "id": "5f6a389d3d9468cdbdfd17ae",
                                    "name": "Form Submission",
                                    "status": "Completed",
                                    "startedAt": "2020-09-22T17:47:09.958Z",
                                    "stepDefinitionId": "5f6a35243d9468da65fd16ac",
                                    "type": "formfill",
                                    "signatures": [],
                                    "users": [
                                      {
                                        "updatedBy": {
                                          "id": "kuali-system",
                                          "impersonatedBy": null
                                        },
                                        "role": "admin",
                                        "systemNotifications": "all",
                                        "approved": true,
                                        "active": true,
                                        "products": [],
                                        "batman": false,
                                        "email": "pat.jensen@kies.edu",
                                        "username": "31824387",
                                        "firstName": "Pat",
                                        "lastName": "Jensen",
                                        "name": null,
                                        "ssoProps": {},
                                        "createdAt": 1600793747817,
                                        "updatedAt": 1603406773635,
                                        "groupId": null,
                                        "phone": null,
                                        "schoolId": "1",
                                        "scopesCm": null,
                                        "id": "5f6a2c933b89c10014407263",
                                        "mongoId": "5f6a2c933b89c10014407263",
                                        "displayName": "Pat Jensen",
                                        "ssoId": "31824387",
                                        "workflowAction": {
                                          "action": "completed",
                                          "date": "2020-09-22T17:47:53.966Z",
                                          "comment": null
                                        }
                                      }
                                    ],
                                    "simulated": false
                                  },
                                  {
                                    "completedAt": "2020-09-22T17:47:54.889Z",
                                    "id": "5f6a38ca74316a173598bb8e",
                                    "isRetry": false,
                                    "name": "Notify Submitter",
                                    "status": "Completed",
                                    "startedAt": "2020-09-22T17:47:54.219Z",
                                    "stepDefinitionId": "5f6a37c7632636bbf76b2a6f",
                                    "type": "notification",
                                    "groups": [],
                                    "users": [
                                      {
                                        "displayName": "pat.jensen@kies.edu",
                                        "email": "pat.jensen@kies.edu",
                                        "id": "anonymous",
                                        "workflowAction": {
                                          "action": "notified",
                                          "date": "2020-09-22T17:47:54.889Z"
                                        }
                                      }
                                    ],
                                    "simulated": false
                                  },
                                  {
                                    "completedAt": "2020-09-22T17:50:47.864Z",
                                    "id": "5f6a38cb74316a7b9a98bb91",
                                    "isRetry": false,
                                    "meta": {},
                                    "name": "Manager Approval",
                                    "startedAt": "2020-09-22T17:47:54.979Z",
                                    "status": "Approved",
                                    "stepDefinitionId": "5f6a37c763263600e66b2a72",
                                    "type": "form-approval",
                                    "groups": [],
                                    "users": [
                                      {
                                        "updatedBy": {
                                          "id": "5e2f39c4222040001ea1d225",
                                          "impersonatedBy": "ldap:31824387"
                                        },
                                        "role": "admin",
                                        "systemNotifications": "all",
                                        "approved": true,
                                        "active": true,
                                        "products": [],
                                        "email": "pat.jensen@kies.edu",
                                        "username": "31824387",
                                        "firstName": "Pat",
                                        "lastName": "Jensen",
                                        "name": null,
                                        "ssoProps": {
                                          "roles": "employee;vpn;support-zendesk;Loggly Users;Bowie Impersonate;bld-pm;bld-engineer-lead;salt-api;bld-engineer;chatops-bld;engineer;aws-bld;Build Impersonate;devops;ipausers;zone-prod"
                                        },
                                        "createdAt": 1600793747817,
                                        "updatedAt": 1600795797155,
                                        "groupId": null,
                                        "phone": null,
                                        "schoolId": null,
                                        "scopesCm": null,
                                        "id": "5f6a2c933b89c10014407263",
                                        "mongoId": "5f6a2c933b89c10014407263",
                                        "displayName": "Pat Jensen",
                                        "ssoId": "31824387",
                                        "workflowAction": {
                                          "action": "approved",
                                          "date": "2020-09-22T17:50:47.672Z",
                                          "comment": ""
                                        }
                                      }
                                    ],
                                    "signatures": [],
                                    "simulated": false
                                  },
                                  {
                                    "completedAt": "2020-09-22T17:51:16.375Z",
                                    "id": "5f6a39783d9468ac0efd17d3",
                                    "isRetry": false,
                                    "meta": {},
                                    "name": "Department Chair Approval",
                                    "startedAt": "2020-09-22T17:50:48.038Z",
                                    "status": "Approved",
                                    "stepDefinitionId": "5f6a37c76326366d8e6b2a75",
                                    "type": "form-approval",
                                    "groups": [
                                      {
                                        "id": "5e2f5758482f6e0017e30e57",
                                        "name": "History",
                                        "role": "Department Chair",
                                        "roleId": "1",
                                        "users": [
                                          {
                                            "updatedBy": {
                                              "id": "kuali-system",
                                              "impersonatedBy": null
                                            },
                                            "role": "admin",
                                            "systemNotifications": "all",
                                            "approved": true,
                                            "active": true,
                                            "products": [],
                                            "batman": false,
                                            "email": "pat.jensen@kies.edu",
                                            "username": "31824387",
                                            "firstName": "Pat",
                                            "lastName": "Jensen",
                                            "name": null,
                                            "ssoProps": {},
                                            "createdAt": 1600793747817,
                                            "updatedAt": 1603406773635,
                                            "groupId": null,
                                            "phone": null,
                                            "schoolId": "1",
                                            "scopesCm": null,
                                            "id": "5f6a2c933b89c10014407263",
                                            "mongoId": "5f6a2c933b89c10014407263",
                                            "displayName": "Pat Jensen",
                                            "ssoId": "31824387",
                                            "workflowAction": {
                                              "action": "approved",
                                              "date": "2020-09-22T17:51:16.039Z",
                                              "comment": "This looks great!"
                                            }
                                          }
                                        ]
                                      }
                                    ],
                                    "users": [],
                                    "signatures": [],
                                    "simulated": false
                                  },
                                  {
                                    "completedAt": "2020-09-22T17:51:25.488Z",
                                    "id": "5f6a39953d9468050efd17da",
                                    "isRetry": false,
                                    "name": "Estimated Cost >= $2000",
                                    "startedAt": "2020-09-22T17:51:17.058Z",
                                    "stepDefinitionId": "5f6a38853d9468188efd178b",
                                    "subflows": [
                                      {
                                        "steps": [
                                          {
                                            "completedAt": "2020-09-22T17:51:25.459Z",
                                            "id": "5f6a39953d9468cfadfd17d9",
                                            "isRetry": false,
                                            "meta": {},
                                            "name": "College Dean Approval",
                                            "startedAt": "2020-09-22T17:51:16.552Z",
                                            "status": "Approved",
                                            "stepDefinitionId": "5f6a37c7632636135f6b2a78",
                                            "type": "form-approval",
                                            "groups": [
                                              {
                                                "id": "5e2f5758ac43f3001f1188ac",
                                                "name": "Family, Home and Social Sciences",
                                                "role": "College Dean",
                                                "roleId": "1",
                                                "users": [
                                                  {
                                                    "updatedBy": {
                                                      "id": "kuali-system",
                                                      "impersonatedBy": null
                                                    },
                                                    "role": "admin",
                                                    "systemNotifications": "all",
                                                    "approved": true,
                                                    "active": true,
                                                    "products": [],
                                                    "batman": false,
                                                    "email": "pat.jensen@kies.edu",
                                                    "username": "31824387",
                                                    "firstName": "Pat",
                                                    "lastName": "Jensen",
                                                    "name": null,
                                                    "ssoProps": {},
                                                    "createdAt": 1600793747817,
                                                    "updatedAt": 1603406773635,
                                                    "groupId": null,
                                                    "phone": null,
                                                    "schoolId": "1",
                                                    "scopesCm": null,
                                                    "id": "5f6a2c933b89c10014407263",
                                                    "mongoId": "5f6a2c933b89c10014407263",
                                                    "displayName": "Pat Jensen",
                                                    "ssoId": "31824387",
                                                    "workflowAction": {
                                                      "action": "approved",
                                                      "date": "2020-09-22T17:51:25.122Z",
                                                      "comment": ""
                                                    }
                                                  }
                                                ]
                                              }
                                            ],
                                            "users": [],
                                            "signatures": [],
                                            "simulated": false
                                          }
                                        ],
                                        "status": "Complete"
                                      }
                                    ],
                                    "type": "conditional",
                                    "users": [],
                                    "simulated": false
                                  },
                                  {
                                    "completedAt": "2020-09-22T17:51:25.768Z",
                                    "id": "5f6a399d3d94685912fd17e6",
                                    "isRetry": false,
                                    "name": "Notify Submitter",
                                    "status": "Completed",
                                    "startedAt": "2020-09-22T17:51:25.603Z",
                                    "stepDefinitionId": "5f6a38853d9468d5adfd1791",
                                    "type": "notification",
                                    "groups": [],
                                    "users": [
                                      {
                                        "updatedBy": {
                                          "id": "5e2f39c4222040001ea1d225",
                                          "impersonatedBy": "ldap:31824387"
                                        },
                                        "role": "admin",
                                        "systemNotifications": "all",
                                        "approved": true,
                                        "active": true,
                                        "products": [],
                                        "email": "pat.jensen@kies.edu",
                                        "username": "31824387",
                                        "firstName": "Pat",
                                        "lastName": "Jensen",
                                        "name": null,
                                        "ssoProps": {
                                          "roles": "employee;vpn;support-zendesk;Loggly Users;Bowie Impersonate;bld-pm;bld-engineer-lead;salt-api;bld-engineer;chatops-bld;engineer;aws-bld;Build Impersonate;devops;ipausers;zone-prod"
                                        },
                                        "createdAt": 1600793747817,
                                        "updatedAt": 1600795797155,
                                        "groupId": null,
                                        "phone": null,
                                        "schoolId": null,
                                        "scopesCm": null,
                                        "id": "5f6a2c933b89c10014407263",
                                        "mongoId": "5f6a2c933b89c10014407263",
                                        "displayName": "Pat Jensen",
                                        "ssoId": "31824387",
                                        "workflowAction": {
                                          "action": "notified",
                                          "date": "2020-09-22T17:51:25.768Z"
                                        }
                                      }
                                    ],
                                    "simulated": false
                                  }
                                ],
                                "status": "Complete"
                              },
                              "workflowStatus": "Complete",
                              "workflowTotalRuntime": 255810,
                              "currentWorkflowSteps": [],
                              "submittedAt": 1600796873804,
                              "formContainer": {
                                "id": "5f6a3524e5e9dd071c124ef6",
                                "label": "Travel Request"
                              },
                              "title": "0001",
                              "updatedAt": "2021-01-13T22:52:33.566Z",
                              "link": "https://taddgiles.kualibuild.com/app/5f6a352488cf8c6265478e3d/document/5f6a389d77d701400f543a29/view",
                              "workflowData": null
                            }
                          }
                        }
                      ],
                      "pageInfo": {
                        "hasNextPage": false,
                        "hasPreviousPage": false,
                        "skip": 0,
                        "limit": 25
                      }
                    }
                  }
                }
              }
           
          

Stalled approvals

You may want to identify the approvals that are In Progress that have been waiting the longest at their current step. Use the same query as above, but with different variables.

Variables

  • Sort the -meta.currentWorkflowSteps.startDate field in reverse order. This sorts the documents with those that have been sitting the longest at the top.
  • Includes documents where worflowStatus is In Progress.
            
  {
    "appId": "5f6a352488cf8c6265478e3d",
    "skip": 0,
    "limit": 25,
    "sort": [
      "-meta.currentWorkflowSteps.startDate"
    ],
    "query": "",
    "fields": {
      "field": "meta.workflowStatus",
      "type": "IS",
      "value": "In Progress"
    }
  }

            
          

Text searching

You can also use the query parameter to search for any text in the documents. Note again that this uses the same query defined above.

Variables

  • Set the query parameter to the text you want to search on.
            
  {
    "appId": "5f6a352488cf8c6265478e3d",
    "skip": 0,
    "limit": 25,
    "sort": [],
    "query": "Los Angeles"
  }