Getting Results with REST API v2

Introduction

The forms/[FORM_ID]/results endpoint can be used to get form results related to the Quiz Add-On, Polls Add-On, and Survey Add-On.

Authentication

See REST API v2 Authentication.

The capability gravityforms_view_entries is required to use GET requests at this endpoint.
This can be filtered using gform_rest_api_capability_get_results.

Getting Results

The forms/[FORM_ID]/results endpoints can be used to get results.

Method

This endpoint accepts GET requests in order to get results.

Path

/gf/v2/forms/[FORM_ID]/results

Required Properties

There are no required properties.

Optional Properties

The request URL can also include the following parameters.

KeyTypeDescription
searcharrayOptional.
An associative array containing the search arguments.
It is expected that search will be provided as JSON.

Search Arguments

An associative array supporting the following properties. Must be provided in request as JSON.

PropTypeDescription
statusstringDefault is active.
The status of the entry. Possible values are activespamtrash.
field_filtersarraySee Field Filters

Field Filters

PropTypeDescription
arrayOne or more associative arrays. See Field Filter.
modestringOptional.
Defaults to all.
Possible values: all or any.
Determines if the found entries have to match all the field filters or any.
Field Filter

An associative array supporting the following properties.

PropTypeDescription
keystringThe field ID, entry property, or entry meta key.
valuestring|integer|float|arrayThe value to find for the specified key.
operatorstringOptional.
Defaults to =.
Possible values: =, IS, CONTAINS, IS NOT, ISNOT, <>, LIKE, NOT IN, NOTIN, or IN.
Lowercase is also supported.
is_numericbooleanOptional.
Indicates if the values of the specified key are numeric.

Response

Success

A successful response will contain a JSON object with the following data This may vary slightly based on the add-on for which results are being retrieved.

KeyTypeDescription
entry_countstringThe number of entries included in the results.
field_dataobjectResults for each field, keyed by field ID and including each choice value and total (grade or score).
statusstringWhether or not the request includes complete results. Returns complete or incomplete.
timestampintegerTimestamp indicating when the last cron task was run to calculate results.
labelsobjectLabels for each field, keyed by field ID and including field label and choice values with associated labels.
.

Usage

cURL Request

curl "https://rocket.test/wp-json/gf/v2/forms/46/results" \
     -u 'ck_5f86565df60696c43af25f9194e106800770b8e9:cs_be0190310fefc061c564168670d0a96d68873c29'

Response

{
  "entry_count": 3,
  "field_data": {
    "1": {
      "glikertcol1307d0217": 1,
      "glikertcol16fe62d85": 0,
      "glikertcol1abdff2ca": 1,
      "glikertcol1734f064a": 1,
      "glikertcol162d7d431": 0
    },
    "3": {
      "grank3552035c7": 12,
      "grank30f9c9492": 8,
      "grank353117d68": 11,
      "grank33a45d22c": 10,
      "grank384c3da75": 4
    },
    "4": {
      "grating448a9311f": 0,
      "grating4bd2f576a": 1,
      "grating4d20d7980": 0,
      "grating407965b55": 1,
      "grating451a23053": 1
    },
    "5": {
      "gsurvey542f6dec1": 0,
      "gsurvey517188a2a": 1,
      "gsurvey550a16b4c": 2
    }
  },
  "status": "complete",
  "timestamp": 1718995135,
  "labels": {
    "1": {
      "label": "Untitled Survey Field",
      "choices": {
        "glikertcol1307d0217": "Strongly disagree",
        "glikertcol16fe62d85": "Disagree",
        "glikertcol1abdff2ca": "Neutral",
        "glikertcol1734f064a": "Agree",
        "glikertcol162d7d431": "Strongly agree"
      }
    },
    "3": {
      "label": "Untitled Survey Field",
      "choices": {
        "grank3552035c7": "First Choice",
        "grank30f9c9492": "Second Choice",
        "grank353117d68": "Third Choice",
        "grank33a45d22c": "Fourth Choice",
        "grank384c3da75": "Fifth Choice"
      }
    },
    "4": {
      "label": "Untitled Survey Field",
      "choices": {
        "grating448a9311f": "Terrible",
        "grating4bd2f576a": "Not so great",
        "grating4d20d7980": "Neutral",
        "grating407965b55": "Pretty good",
        "grating451a23053": "Excellent"
      }
    },
    "5": {
      "label": "Untitled Survey Field",
      "choices": {
        "gsurvey542f6dec1": "First Choice",
        "gsurvey517188a2a": "Second Choice",
        "gsurvey550a16b4c": "Third Choice"
      }
    }
  }
}