Gravity Forms form objects can be queried with gfForm
. The example query below shows how you can get a Form and its associated formFields
).
The id
input accepts either the Gravity Forms form ID (idType: DATABASE_ID
) or a global ID (idType: ID
).
{
gfForm(id: 50, idType: DATABASE_ID) {
cssClass
databaseId
dateCreated
formFields {
nodes {
databaseId
type
... on TextField {
label
description
}
}
}
pagination{
lastPageButton {
text
type
}
}
title
}
}
The code comments in the example query below shows how you can fetch and filter data for multiple forms at once.
Cursor-based pagination is supported. You can use the first
, last
, before
and after
fields, along with the data inside of pageInfo
and the cursors returned by the API to get each page of forms data.
{
gfForms(
first: 10
after: "YXJyYXljb25uZWN0aW9uOjM=" # Or pass null to start from the beginning.
where: {
# List of all the form IDs to include.
formIds: [1]
# Sort fields in ascending order by title
orderby: { order: ASC, field: "title" }
# Show only active forms.
status: ACTIVE
}
) {
pageInfo {
startCursor
endCursor
hasPreviousPage
hasNextPage
}
edges {
cursor
node {
databaseId
title
formFields(first: 300) {
nodes {
type
databaseId
cssClass
... on TextField {
label
}
}
}
}
}
}
}