Validation Errors CSS Selectors

Validation Errors CSS Selectors

Validation Error MessageValidation – Error ContainerValidation – Error Description Message

Validation Error Message
Main validation error message shown at the top of the form.

example: validation error message (div) – applies to all forms
body .gform_wrapper .validation_error {border: 1px solid red}

example: validation error message (div) – applies just to form ID #1
body #gform_wrapper_1 .validation_error {border: 1px solid red}

Validation – Error Container
Individual list items containing inputs with invalid values

example: validation – error container (li) – applies to all forms
body .gform_wrapper .gform_body .gform_fields .gfield_error {border: 1px solid red}

example: validation – error container (li) – applies just to form ID #1
body #gform_wrapper_1 .gform_body .gform_fields .gfield_error {border: 1px solid red}

Validation – Error Description Message
Description/error message below inputs with invalid values

example: validation – error description message (div) – applies to all forms
body .gform_wrapper .gform_body .gform_fields .gfield_error .validation_message {border: 1px solid red}

example: validation – error description message (div) – applies just to form ID #1
body #gform_wrapper_1 .gform_body .gform_fields .gfield_error .validation_message {border: 1px solid red}

Using the PayPal Checkout Add-On

Using the PayPal Checkout Add-On

IntroductionPrerequisitesSetup PayPal CheckoutSetup Your FormConfiguring a FeedViewing Sales ResultsTransaction Types SupportedPayPal Checkout Add-On HooksAdd-On Framework Hooks

Introduction
The Gravity Forms PayPal Checkout Add-On, when connected to the PayPal Checkout, allows you to quickly and easily accept payments from 286 million PayPal customers, in over 100 currencies and across 200 markets, with advanced Fraud Protection and unprecedented control.
This add-on was previously named PayPal Commerce Platform at version 1.0. Note that the filters do still use the _ppcp_ naming convention, and have not been changed to avoid any issues with existing hook users.
Prerequisites
You will need Gravity Forms version 2.4 or greater and the Gravity Forms PayPal Checkout Add-On installed and activated.
Because of the secure nature of capturing payment information, you will be required to install an SSL certificate on your web site if you have not already done so. You will also need to configure your WordPress site to work properly with SSL.
Contact your web host if you need assistance purchasing and configuring an SSL certificate.
If you need assistance configuring your WordPress site to work with SSL, we recommend the Really Simple SSL Plugin.
Setup PayPal Checkout
Learn how to setup the PayPal Checkout Add-on in our Setting Up The PayPal Checkout Add-On article.
Setup Your Form
Refer to the Setting Up A PayPal Checkout Compatible Form article for detailed instructions on how to setup your form to be compatible with the PayPal Checkout Add-on.
Configuring a Feed
See the Configuring A Feed For The PayPal Checkout Add-On article.
Viewing Sales Results
After creating a feed and making your first sale, you can view the results on the Sales Results page.  Review Viewing Sales Results article for more information.
Transaction Types Supported
The PayPal Checkout Add-on supports one-time payments (aka the Products and Services transaction type) and recurring payments (Subscriptions Transaction Type). You can also configure an Authorize and Capture transaction.
PayPal Checkout Add-On Hooks
The PayPal Checkout Add-On provides hooks that can be used to modify the default functionality or extend it. For more information, review the PayPal Checkout Add-On Hooks.
Add-On Framework Hooks
Because the PayPal Checkout Add-On is built using the Add-On Framework it also inherits any hooks available in the framework methods it uses such as:
gform_{$SHORT_SLUG}_field_value for changing a field value before it is passed to the PayPal Checkout.

v1 Examples

v1 Examples

EntriesRetrieve EntriesRetrieve the latest 10 entries for a formRetrieve all entries for a formRetrieve entries sorted by a specific fieldRetrieve entries sorted ascendingRetrieve entries by statusRetrieve entries more recent than a specific dateRetrieve entries for a date rangeRetrieve entries using field filters (one condition)Retrieve entries using field filters (multiple conditions)Retrieve entries using field filters (contains condition)Retrieve entries using search criteria and field filtersRetrieve entries that have been readRetrieve all entries with pagingRetrieve a single entryRetrieve specific fields for a single entryRetrieve specific fields for multiple entriesCreate EntriesCreate EntriesCreate Entry for a Specific FormUpdate EntriesUpdate Single Entry (Create Entry Array Manually)Update Single Entry (Create Entry Array Using Existing Database Record)Update Entries (Create Entries Array Manually)Update Entries (Create Entries Array Using Existing Database Records)Delete EntriesDelete Multiple EntriesFormsRetrieve FormsRetrieve all active formsRetrieve a single formRetrieve multiple formsInsert FormsInsert a single formInsert form with the confirmation set to redirectInsert form with the confirmation set to pageInsert form with a conditional confirmationInsert form with notifications sent to a specific email addressInsert form with notification set to use an email fieldInsert form with notification set to use routingInsert multiple formsUpdate FormsUpdate multiple formsDelete FormsForm SubmissionsComplex FieldsSubmit a list field that has a single columnSubmit a list field that has multiple columnsSubmit a Multi-Select FieldPricing FieldsSingle Product FieldSingle Product Field With OptionOption Field as a Checkbox

This article includes more detailed examples of how to interact with the REST API v1, formerly called the Web API. It is a work in progress. More examples will be added over time.
Entries
Retrieve Entries
Retrieve the latest 10 entries for a form
The example below retrieves the 10 most recent entries for form id 28. Paging is set to 10 by default.
PHP
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273public static function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;} $base_url = 'http://localhost/wpdev/gravityformsapi/';$api_key = 'your_api_key';$private_key = 'your_private_key';$method  = 'GET';$route = 'forms/28/entries';$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, $method, $route, $expires );$sig = self::calculate_signature( $string_to_sign, $private_key ); $url = $base_url . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; $response = wp_remote_request( $url, array('method' => 'GET' ) ); if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    echo 'There was an error attempting to access the API.';    die();} $body_json = wp_remote_retrieve_body( $response );//results are in the "body" and are json encoded, decode them and put into an array$body = json_decode( $body_json, true ); $data            = $body['response'];$status_code     = $body['status'];$total           = 0;$total_retrieved = 0; if ( $status_code <= 202 ){    //entries retrieved successfully    $entries = $data['entries'];    $status  = $status_code;    $total              = $data['total_count'];    $total_retrieved    = count( $entries );}else {    //entry retrieval failed, get error information    $error_code         = $data['code'];    $error_message      = $data['message'];    $error_data         = isset( $data['data'] ) ? $data['data'] : '';    $status             = $status_code . ' - ' . $error_code . ' ' . $error_message . ' ' . $error_data;}//display results in a simple page?>

    

Results

    

Status Code:

    

Total Count:

    

Total Retrieved:

    

JSON Response:

    
    

         0 ) {            echo '

';            foreach ( $entries as $entry ){                echo '

';            }            echo '

Form ID Entry ID Date Created
' . $entry['form_id'] . ' ' . $entry['id'] . ' ' . $entry['date_created'] . '

';        }        ?>    


JavaScript
1234567891011121314151617181920212223242526272829303132333435363738
The response from this example will look like the following if successful:
1{"status":200,"response":{"total_count":"22","entries":[{"id":"171","form_id":"28","date_created":"2015-06-15 22:43:23","is_starred":0,"is_read":1,"ip":"::1","source_url":"http://localhost/wpdev/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":"","is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Manual","1.6":"Creation2","2":"create entry x","3":"create entry 2","1.2":"","1.4":"","1.8":""},{"id":"170","form_id":"28","date_created":"2015-06-15 22:43:23","is_starred":0,"is_read":1,"ip":"::1","source_url":"http://localhost/wpdev/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":"","is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Manual","1.6":"Creation1","2":"create entry x","3":"create entry with form id specified","1.2":"","1.4":"","1.8":""},{"id":"169","form_id":"28","date_created":"2015-06-15 22:43:23","is_starred":0,"is_read":1,"ip":"::1","source_url":"http://localhost/wpdev/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":"","is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Manual","1.6":"Creation2","2":"create entry 2","3":"create entry 2","1.2":"","1.4":"","1.8":""},{"id":"168","form_id":"28","date_created":"2015-06-15 22:43:23","is_starred":0,"is_read":1,"ip":"::1","source_url":"http://localhost/wpdev/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":"","is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Manual","1.6":"Creation1","2":"create entry","3":"create entry with form id specified","1.2":"","1.4":"","1.8":""},{"id":"167","form_id":"28","date_created":"2015-06-15 22:43:23","is_starred":0,"is_read":1,"ip":"::1","source_url":"http://localhost/wpdev/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":"","is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Manual","1.6":"Creation2","2":"create entry 2","3":"create entry 2","1.2":"","1.4":"","1.8":""},{"id":"166","form_id":"28","date_created":"2015-06-15 22:43:23","is_starred":0,"is_read":1,"ip":"::1","source_url":"http://localhost/wpdev/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":"","is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Manual","1.6":"Creation1","2":"create entry","3":"create entry with form id specified","1.2":"","1.4":"","1.8":""},{"id":"165","form_id":"28","date_created":"2015-06-15 22:43:23","is_starred":0,"is_read":1,"ip":"::1","source_url":"http://localhost/wpdev/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":"","is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Manual","1.6":"Creation2","2":"create entry 2","3":"create entry 2","1.2":"","1.4":"","1.8":""},{"id":"164","form_id":"28","date_created":"2015-06-15 22:43:23","is_starred":0,"is_read":1,"ip":"::1","source_url":"http://localhost/wpdev/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":"","is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Manual","1.6":"Creation1","2":"create entry","3":"create entry with form id specified","1.2":"","1.4":"","1.8":""},{"id":"163","form_id":"28","date_created":"2015-07-01 20:03:09","is_starred":0,"is_read":1,"ip":"::1","source_url":"http://localhost/wpdev/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":null,"is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"spam","1.3":"July","1.6":"First","2":"test","1.2":"","1.4":"","1.8":"","3":""},{"id":"162","form_id":"28","date_created":"2015-06-24 20:01:31","is_starred":0,"is_read":0,"ip":"::1","source_url":"http://localhost/wpdev/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":null,"is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"trash","1.3":"d5","1.6":"d5","2":"d5","1.2":"","1.4":"","1.8":"","3":""}]}}
If no entries are located for the specified form, the response will look like the following:
1{"status":200,"response":{"total_count":"0","entries":[]}}
Retrieve all entries for a form
To retrieve all entries for a form, you may specify the page size within the URL』s querystring. To do this, you may use the example above and add the querystring parameter 「&paging[page_size]=」 to the URL as in the example below. In this example, the size is set to 1000 since this form has very few entries. Because you may not have an idea of how many entries exist for a form, you could simply set the size to a very large number, or even run a query to get the entry count and then set the page_size greater than the count. To see more information about paging, check out the Paging section in the REST API v1 article.
1http://localhost/wpdev/gravityformsapi/forms/28/entries/?paging[page_size]=1000
Retrieve entries sorted by a specific field
To retrieve entries and have them sorted by a specific field, you may specify the sorting key within the URL』s querystring. In the example below, field id 1.3 (first name field on this form) is used as the sort key. You may use field ids, or the set of available entry meta keys, like date_created, payment_status, created_by, etc. To see more information about sorting and which entry meta keys may be used, check out the Sorting section in the REST API v1 article.
1http://localhost/wpdev/gravityformsapi/forms/28/entries/?sorting[key]=1.3
Retrieve entries sorted ascending
To retrieve entries and have them sorted ascending, instead of the default descending, you may specify the sorting direction within the URL』s querystring. In the example below, the direction is set to 「ASC」 for ascending. The results will be sorted by field id 1.3 ascending. In this case, by first name alphabetically. To see more information about sorting, check out the Sorting section in the REST API v1 article.
1http://localhost/wpdev/gravityformsapi/forms/28/entries/?sorting[direction]=ASC
Retrieve entries by status
The example below retrieves entries that are currently in the trash. To see more information about retrieving entries with search criteria, check out the Search Criteria section the REST API v1 article.
1http://localhost/wpdev/gravityformsapi/forms/28/entries/?search[status]=trash
Retrieve entries more recent than a specific date
The example below retrieves entries which have been created on 06/24/2014 or are newer.
1http://localhost/wpdev/gravityformsapi/forms/28/entries/?search[start_date]=2015-06-24
Retrieve entries for a date range
The example below retrieves entries that were created on 06/15/2015 through 06/24/2015 (inclusive).
1http://localhost/wpdev/gravityformsapi/forms/28/entries/?search[start_date]=2015-06-15&search[end_date]=2015-06-24
Retrieve entries using field filters (one condition)
The example below retrieves entries where the last name field (id 1.6) is 「Draven」. The search field filters must be a JSON string. Create your array of search criteria, JSON-encode it, and then URL encode it. To see more information about using field filters, check out the Field Filters section in the REST API v1 article
PHP
1234567891011121314151617//create the field filter array with key, operator, value and place it inside another array$field_filters = array (                     array(                         'key'      => '1.6',                         'operator' => 'is',                         'value' => 'Draven'                     )                 ); //set field_filters to array$search['field_filters'] = $field_filters; //convert the array to a JSON string and url encode it so the JSON formatting persists$search_json = urlencode( json_encode( $search ) ); //include field filters in search querystring parameter$url = $base_url . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires . '&paging[page_size]=1000&search=' . $search_json;
JavaScript
123456789101112131415var search = {        field_filters : [            {                key: '2.6',                value: 'Harris',                operator: 'is'            }        ]    }; //convert to a JSON string and url encode it so the JSON formatting persistssearch = encodeURI(JSON.stringify(search)); //add search to urlurl += '&search=' + search;
The JSON string created by the code above and used in the querystring will look like the following before it is URL encoded:
1{"field_filters":[{"key":"1.6","operator":"is","value":"Draven"}]}
Retrieve entries using field filters (multiple conditions)
The example below retrieves entries where the last name field (1.6) is 「Draven」 and the first name field (1.3) is not 「Eric」. If all conditions specified need to be met, the 「mode」 is set to 「all」 (the keyword 「AND」 is used in the database query). If all conditions are not necessary, set the 「mode」 to 「any」 (the keyword 「OR」 is used in the database query). The default mode is 「all」 so you do not need to include it when all conditions are required. To see more information about using field filters, check out the Field Filters section in the REST API v1 article.
PHP
1234567891011121314151617$field_filters = array (                     'mode' => 'any',                     array(                         'key'      => '1.6',                         'operator' => 'is',                         'value'    => 'Draven'                     ),                     array(                         'key'      => '1.3',                         'operator' => 'isnot',                         'value'    => 'Eric'                     ),                 );$search['field_filters'] = $field_filters;$search_json = urlencode( json_encode( $search ) ); $url = $base_url . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires . '&paging[page_size]=1000&search=' . $search_json;
JavaScript
1234567891011121314151617181920var search = {        field_filters : [            {                key: '2.6',                value: 'Harris',                operator: 'is'            },                        {                key: '2.3',                value:'Xander',                operator: 'is'            }        ]    }; //convert to a JSON string and url encode it so the JSON formatting persistssearch = encodeURI(JSON.stringify(search)); //add search to urlurl += '&search=' + search;
The JSON string created by the code above and used in the querystring will look like the following before it is URL encoded:
1{"field_filters":{"mode":"any","0":{"key":"1.6","operator":"is","value":"Draven"},"1":{"key":"1.3","operator":"isnot","value":"Eric"}}}
Retrieve entries using field filters (contains condition)
The example below retrieves entries that have the text 「er」 as part of the last name field (id 1.6).
PHP
1234567891011$field_filters = array (                     array(                         'key'      => '1.6',                         'operator' => 'contains',                         'value'    => 'er'                     ),                 );$search['field_filters'] = $field_filters;$search_json = urlencode( json_encode( $search ) ); $url = $base_url . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires . '&paging[page_size]=1000&search=' . $search_json;
JavaScript
123456789101112131415var search = {        field_filters : [            {                key: '2.6',                operator: 'contains',                value: 'er'            }        ]    }; //convert to a JSON string and url encode it so the JSON formatting persistssearch = encodeURI(JSON.stringify(search)); //add search to urlurl += '&search=' + search;
The JSON string created by the code above and used in the querystring will look like the following before it is URL encoded:
1{"field_filters":[{"key":"1.6","operator":"contains","value":"er"}]}
Retrieve entries using search criteria and field filters
The example below retrieves entries that have the text 「Test」 as part of the last name field (id 1.6) and have been created since 2016-10-10
PHP
12345678910111213$field_filters = array (            array(                'key'       => '1.6',                'operator'  => 'contains',                'value'     => 'Test'            ),        );        $search = [];        $search['field_filters'] = $field_filters;        $search['start_date'] = '2016-10-10';        $search_json = urlencode( json_encode( $search ) );         $url .= '&search=' . $search_json;
JavaScript
12345678910111213141516var search = {        field_filters : [            {                key: '1.6',                operator: 'contains',                value: 'Test'            }        ],        start_date : '2016-10-10'}; //convert to a JSON string and url encode it so the JSON formatting persistssearch = encodeURI(JSON.stringify(search)); //add search to urlurl += '&search=' + search;
The JSON string created by the code above and used in the querystring will look like the following before it is URL encoded:
1{"field_filters":[{"key":"1.6","operator":"contains","value":"Test"}],"start_date":"2016-10-10"}
Retrieve entries that have been read
PHP
1234567891011$field_filters = array (                     array(                         'key'      => 'is_read',                         'operator' => 'is',                         'value'    => 1                     ),                 );$search['field_filters'] = $field_filters;$search_json = urlencode( json_encode( $search ) ); $url = $base_url . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires . '&paging[page_size]=1000&search=' . $search_json;
JavaScript
12345678910111213141516var search = {        field_filters : [            {                key: 'is_read',                operator: 'is',                value: 1             }        ]    }; //convert to a JSON string and url encode it so the JSON formatting persistssearch = encodeURI(JSON.stringify(search)); //add search to urlurl += '&search=' + search;
Retrieve all entries with paging
The example below is a basic use of paging with previous/next links. The page size is set to 5 and the offset is used to control which results are displayed as you navigate through the pages. To see more information about paging, see the Paging section of the REST API v1 article.
PHP
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112public static function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;}$base_url = 'http://localhost/wpdev/gravityformsapi/';$api_key = '9419b823a1';$private_key = '4d7640ad3ffe2ec';$method  = 'GET';$route = 'entries';$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, $method, $route, $expires );$sig = self::calculate_signature( $string_to_sign, $private_key ); $page_size = 5;$offset = 0;if ( isset( $_GET['paging']['offset'] ) ){    $offset = $_GET['paging']['offset'];} $url = $base_url . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires . '&paging[$page_size]=' . $page_size . '&paging[offset]=' . $offset; $response = wp_remote_request( $url, array('method' => 'GET' ) ); if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    echo 'There was an error attempting to access the API.';    die();} $body_json = wp_remote_retrieve_body( $response );//results are in the "body" and are json encoded, decode them and put into an array$body = json_decode( $body_json, true ); $data            = $body['response'];$status_code     = $body['status'];$total           = 0;$total_retrieved = 0; if ( $status_code <= 202 ){    //entries retrieved successfully    $entries         = $data['entries'];    $status          = $status_code;    $total           = $data['total_count'];    $total_retrieved = count( $entries );}else {    //entry retrieval failed, get error information    $error_code    = $data['code'];    $error_message = $data['message'];    $error_data    = isset( $data['data'] ) ? $data['data'] : '';    $status        = $status_code . ' - ' . $error_code . ' ' . $error_message . ' ' . $error_data;}//display results in a simple page?>

    

Results

    

Status Code:

    

Total Count:

    

Total Retrieved:

    

JSON Response:

    
    

         0 ) {            echo '

';            foreach ( $entries as $entry ){                echo '

';            }            echo '

Form ID Entry ID Date Created
' . $entry['form_id'] . ' ' . $entry['id'] . ' ' . $entry['date_created'] . '

';        }         if ( $total > $total_retrieved ){            //paging in effect            $query_string = $_SERVER['QUERY_STRING'];            parse_str( $query_string, $params );            $paging_link = '';            if ( $total_retrieved == $page_size ){                //see if previous link needs to be built                $page_offset = isset( $params['paging']['offset'] ) ? $params['paging']['offset'] : 0;                if ( $page_offset <> 0 ) {                    $previous_page_offset = $params['paging']['offset'] - $page_size;                    if ( $previous_page_offset < 0 ){                        $previous_page_offset = 0;                    }                    $params['paging']['offset'] = $previous_page_offset;                    $page_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '?' . http_build_query( $params );                    $paging_link = 'Previous     ';                }                $params['paging']['offset'] = $page_offset + $page_size;                $page_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '?' . http_build_query( $params );                $paging_link .= 'Next';            }            else {                $page_offset = $params['paging']['offset'] - $page_size;                if ( $page_offset < 0 ){                    $page_offset = 0;                }                $params['paging']['offset'] = $page_offset;                $page_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '?' . http_build_query( $params );                $paging_link = 'Previous';            }             echo $paging_link;        }        ?>    


JavaScript
1234567891011121314151617181920212223242526272829303132333435363738394041
Retrieve a single entry
This example may be viewed in the REST API v1 article.
Retrieve specific fields for a single entry
This example may be viewed in the REST API v1 article.
Retrieve specific fields for multiple entries
This example may be viewed in the REST API v1 article.
Create Entries
Create Entries
This example may be viewed in the REST API v1 article.
Create Entry for a Specific Form
This example may be viewed in the REST API v1 article.
Update Entries
Update Single Entry (Create Entry Array Manually)
The example below updates entry id 157.
PHP
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273public static function calculate_signature( $string, $private_key ) {  $hash = hash_hmac( 'sha1', $string, $private_key, true );  $sig = rawurlencode( base64_encode( $hash ) );  return $sig;} $base_url = 'http://localhost/wpdev/gravityformsapi/';$api_key = 'your_api_key';$private_key = 'your_private_key';$method = 'PUT';$route = 'entries/157';$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, $method, $route, $expires );$sig = self::calculate_signature( $string_to_sign, $private_key ); $url = $base_url . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; $entry = array(             'form_id'      => '28',             'date_created' => '2015-06-15 22:43:23',             'is_starred'   => 0,             'is_read'      => 1,             'ip'           => '::1',             'source_url'   => 'http://localhost/wpdev/?gf_page=preview&id=28',             'currency'     => 'USD',             'created_by'   => 1,             'user_agent'   => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0',             'status'       => 'active',             '1.3'          => 'Eric',             '1.6'          => 'Draven',             '2'            => 'brandonlee',             '3'            => 'The Crows',     ); $entry_json = json_encode( $entry ); $response = wp_remote_request( $url, array( 'method' => $method, 'body' => $entry_json ) ); if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    echo 'There was an error attempting to access the API.';    die();} $body_json = wp_remote_retrieve_body( $response );//results are in the "body" and are json encoded, decode them and put into an array$body = json_decode( $body_json, true ); $data        = $body['response'];$status_code = $body['status']; if ( $status_code <= 202 ){    //entries retrieved successfully    $status  = $status_code;}else {    //entry update failed, get error information    $error_code    = $data['code'];    $error_message = $data['message'];    $error_data    = isset( $data['data'] ) ? $data['data'] : '';    $status        = $status_code . ' - ' . $error_code . ' ' . $error_message . ' ' . $error_data;}//display results in a simple page?>

    

Results

    

Status Code:

    

JSON Response:


JavaScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
Update Single Entry (Create Entry Array Using Existing Database Record)
This example may be viewed in the REST API v1 article.
Update Entries (Create Entries Array Manually)
This example may be viewed in the REST API v1 article.
Update Entries (Create Entries Array Using Existing Database Records)
PHP
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576public static function calculate_signature( $string, $private_key ) {  $hash = hash_hmac( 'sha1', $string, $private_key, true );  $sig = rawurlencode( base64_encode( $hash ) );  return $sig;} $base_url = 'http://localhost/wpdev/gravityformsapi/';$api_key = 'your_api_key';$private_key = 'your_private_key';$method = 'PUT';$route = 'entries';$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, $method, $route, $expires );$sig = self::calculate_signature( $string_to_sign, $private_key ); $url = $base_url . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; //get entry object for id 156 and modify$entry1 = GFAPI::get_entry( 156 );$entry1['is_starred'] = 1;$entry1['3'] = 'Newt';//add entry to entries array$entries[] = $entry1; //get entry object for id 157 and modify$entry2 = GFAPI::get_entry( 157 );$entry2['2'] = 'eric draven';$entry2['is_read'] = 0;//add entry to entries array$entries[] = $entry2; //json encode array$entry_json = json_encode( $entries ); $response = wp_remote_request( $url, array( 'method' => $method, 'body' => $entry_json ) ); if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    echo 'There was an error attempting to access the API.';    die();} $body_json = wp_remote_retrieve_body( $response );//results are in the "body" and are json encoded, decode them and put into an array$body = json_decode( $body_json, true ); $data        = $body['response'];$status_code = $body['status']; if ( $status_code <= 202 ){    //entries retrieved successfully    $status  = $status_code;}else {    //entry update failed, get error information, error could just be a string    if ( is_array( $data )){        $error_code    = $data['code'];        $error_message = $data['message'];        $error_data    = isset( $data['data'] ) ? $data['data'] : '';        $status        = $status_code . ' - ' . $error_code . ' ' . $error_message . ' ' . $error_data;    }    else{        $status = $data;    }}//display results in a simple page?>

    

Results

    

Status Code:

    

JSON Response:


JavaScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
Delete Entries
Delete Multiple Entries
This example may be viewed in the REST API v1 article.
Forms
Retrieve Forms
Retrieve all active forms
This example retrieves all active forms and displays them in a list.
PHP
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;} //set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'forms'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'GET', $route, $expires );$sig = self::calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wpdev/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; //retrieve data$response = wp_remote_request( $url, array( 'method' => 'GET' ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    die( "Could not retrieve forms." );} //forms retrieved successfully$forms = $body['response']; //display results in a simple page?>

    

Forms

    

         Form ID Form Title Entry Count

';            foreach ( $forms as $form ) {                echo '

' . $form['id'] . ' ' . $form['title'] . ' ' . $form['entries'] . '

';            }            echo '

';        }        ?>    

    
    

JSON Response:


JavaScript
123456789101112131415161718192021222324252627282930313233343536373839404142
Retrieve a single form
This example retrieves a single form and displays the details, along with field information.
PHP
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;} //set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'forms/67'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'GET', $route, $expires );$sig = calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wp/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; //retrieve data$response = wp_remote_request( $url, array( 'method' => 'GET' ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    die( "Could not retrieve forms." );} //forms retrieved successfully$form = $body['response']; //display results in a simple page?>

    

Forms

    

         Form ID Form Title Field Count

';            //foreach ( $forms as $form ) {                $fields = $form['fields'];                echo '

' . $form['id'] . ' ' . $form['title'] . ' ' . count( $fields ) . '

';                if ( $fields ){                    echo '

';                    foreach ( $fields as $field ){                        echo '

';                    }                    echo '

Field ID Field Label Field Type
' . $field['id'] . ' ' . GFCommon::get_label( $field ) . ' ' . $field['type'] . '

';                }                echo '

 

';            //}            echo '

';        }        ?>    

    
    

JSON Response:


JavaScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
Retrieve multiple forms
This example retrieves multiple forms and displays the details, along with field information. If a form cannot be found, false is returned instead of a form object.
PHP
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;} //set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'forms/67;68;1'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'GET', $route, $expires );$sig = calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wpdev/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; //retrieve data$response = wp_remote_request( $url, array( 'method' => 'GET' ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    die( "Could not retrieve forms." );} //forms retrieved successfully$forms = $body['response']; //display results in a simple page?>

    

Forms

    

         Form ID Form Title Field Count

';            foreach ( $forms as $form_id => $form ) {                if ( ! $form ){                    //if a form is not found, false is returned                    echo '

Form ID ' . $form_id . ' could not be found.

';                }                else{                    $fields = $form['fields'];                    echo '

' . $form['id'] . ' ' . $form['title'] . ' ' . count( $fields ) . '

';                    if ( $fields ){                        //display basic field info                        echo '

';                        foreach ( $fields as $field ){                            echo '

';                        }                        echo '

Field ID Field Label Field Type
' . $field['id'] . ' ' . GFCommon::get_label( $field ) . ' ' . $field['type'] . '

';                    }                }                echo '

 

';            }            echo '

';        }        ?>    

    
    

JSON Response:


JavaScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
Insert Forms
Insert a single form
The example below inserts a new form.
PHP
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;} //set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'forms'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'POST', $route, $expires );$sig = calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wpdev/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; $form = array(        array(            'title'          => 'API Generated Form',            'description'    => 'This is the description for the form generated by the API',            'labelPlacement' => 'top_label',            'button'         => array(                            'type' => 'text'            ),            'confirmations'  => array(                        array(                            'id' => 0,                            'name' => 'Default Confirmation',                            'type' => 'message',                            'message' => 'Thanks for contacting us! We will get in touch with you shortly.',                            'isDefault' => true,                        ),            ),            'fields'     => array(                         array(                        'id' => '1',                        'label' => 'My Text',                        'type'  => 'text'                         )                    ),        ),); //json encode array$form_json = json_encode( $form ); //retrieve data$response = wp_remote_request( $url, array( 'method' => 'POST', 'body' => $form_json ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    $error = $body['response'];     //form insert failed, get error information    $error_code     = $error['code'];    $error_message  = $error['message'];    $error_data     = isset( $error['data'] ) ? $error['data'] : '';    $status     = "Code: {$error_code}. Message: {$error_message}. Data: {$error_data}.";    die( "Could not post forms. {$status}" );} $form_id = $body['response'][0];echo 'The following form id was created: ' . $form_id . '
';
JavaScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
Insert form with the confirmation set to redirect
The example below shows how to build the form array to have the confirmation as a redirect.
PHP
1234567891011121314151617181920212223242526$form = array(            array(                'title'      => 'API Generated Form With Redirect Confirmation',                'description'    => 'This is the description for the form generated by the API',                'labelPlacement' => 'top_label',                'button'         => array(                    'type' => 'text'                ),                'confirmations'  => array(                    array(                        'id' => 0,                        'name' => 'Default Confirmation',                        'type' => 'redirect',                        'url' => 'http://www.rocketgenius.com',                        'isDefault' => true,                    ),                ),                'fields'         => array(                    array(                        'id' => '1',                        'label' => 'My Text',                        'type'  => 'text'                    )                ),            ),        );
JavaScript
1234567891011121314var form = {    title       : 'API Generated Form With Redirect Confirmation',    description : 'This is the description for the form generated by the API',    labelPlacement  : 'top_label',    button          : {type : 'text'},    confirmations   : [        {id : 0, name : 'Default Confirmation', type : 'redirect', url : 'http://www.rocketgenius.com', isDefault : true},        {id : 1, name : 'Confirmation 2', type : 'message', message : 'Thanks for contacting us! We will get in touch with you shortly.', isDefault : false}    ],    fields          : [        {id : '1', label : 'My Text', type : 'text'},        {id : '2', label : 'More Text', type : 'text'}    ]};
Insert form with the confirmation set to page
The example below shows how to build the form array to have the confirmation as a page.
PHP
1234567891011121314151617181920212223242526$form = array(        array(            'title'          => 'API Generated Form with Page Confirmation',            'description'    => 'This is the description for the form generated by the API',            'labelPlacement' => 'top_label',            'button'         => array(                'type' => 'text'            ),            'confirmations'  => array(                          array(                        'id' => 0,                        'name' => 'Default Confirmation',                        'type' => 'page',                        'pageId' => 500,                        'isDefault' => true,                          ),            ),            'fields'  => array(                    array(                        'id' => '1',                        'label' => 'My Text',                        'type'  => 'text'                    )                ),            ),        );
JavaScript
12345678910111213var form = {    title       : 'API Generated Form with Page Confirmation',    description : 'This is the description for the form generated by the API',    labelPlacement  : 'top_label',    button      : {type : 'text'},    confirmations   : [        {id : 0, name : 'Default Confirmation', type : 'page', pageId : 2, isDefault : true}    ],    fields      : [        {id : '1', label : 'My Text', type : 'text'},        {id : '2', label : 'More Text', type : 'text'}    ]};
Insert form with a conditional confirmation
The example below shows how to build the form array to have a conditional confirmation.
PHP
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354$form = array(    array(        'title'      => 'API Generated Test Confirmations with new array 3',        'description'    => 'This is the description for the form generated by the API',        'labelPlacement' => 'top_label',        'button'     => array(                          'type' => 'text'                            ),        'confirmations'  => array(                          array(                        'id'        => 0,                        'name'      => 'Default Confirmation',                        'type'      => 'message',                        'message'   => 'Thanks for contacting us! We will get in touch with you shortly.',                        'isDefault' => true,                          ),                          array(                        'id'        => 1,                        'name'      => 'My Conditional',                        'type'      => 'message',                        'message'   => 'This is my conditional confirmation that will be used if the text is test.',                        'isDefault' => false,                        'conditionalLogic' => array(                                    'actionType' => 'show',                                'logicType'  => 'any',                                'rules'      => array(                                          array(                                            'fieldId'  => 1,                                            'operator' => 'is',                                            'value'    => 'test',                                          ),                                          array(                                            'fieldId'  => 1,                                            'operator' => 'is',                                            'value'    => 'TEST',                                          ),                                          array(                                            'fieldId'  => 1,                                            'operator' => 'is',                                            'value'    => 'Test',                                          ),                                                                                ),                                 ),                        )        ),        'fields' => array(                  array(                'id' => '1',                'label' => 'My Text',                'type'  => 'text'                 )        ),    ),);
JavaScript
12345678910111213141516171819202122var form = {    title       : 'API Generated Test Confirmations Conditionals',    description : 'This is the description for the form generated by the API',    labelPlacement  : 'top_label',    button      : {type : 'text'},    confirmations   : [        {id : '0', name : 'Default Confirmation', type : 'message', message : 'Thanks for contacting us! We will get in touch with you shortly.', isDefault : true},        {id : '1', name : 'My Conditional', type : 'message', message : 'This is my conditional confirmation that will be used if the text is test.', isDefault : false,            conditionalLogic : {actionType : 'show', logicType : 'any',                rules : [                    {fieldId : '1', operator : 'is', value : 'test'},                    {fieldId : '1', operator : 'is', value : 'TEST'},                    {fieldId : '1', operator : 'is', value : 'Test'}                ]            }        }    ],    fields      : [        {id : '1', label : 'My Text', type : 'text'},        {id : '2', label : 'More Text', type : 'text'}    ]};
Insert form with notifications sent to a specific email address
The example below shows how to build the form array to have notifications which are sent to a specific email address. Please see the article titled Notifications Object for more details about what may be included when building the notification array.
PHP
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950$form = array(            array(                'title'          => 'API Generated Form With Notification Sent to Specific Email Address',                'description'    => 'This is the description for the form generated by the API',                'labelPlacement' => 'top_label',                'button'         => array(                    'type' => 'text'                ),                'notifications' => array(                    array(                        'id'        => uniqid( '0' ),                        'name'      => 'Admin Notification',                        'to'        => '{admin_email}',                        'toType'    => 'email',                        'event'     => 'form_submission',                        'subject'   => 'New submission from {form_title}',                        'message'   => '{all_fields}',                        'from'      => '{admin_email}',                        'fromName'  => 'Administrator'                    ),                    array(                        'id'        => uniqid( '1' ),                        'name'      => 'Admin Notification 2',                        'to'        => '{admin_email}',                        'toType'    => 'email',                        'event'     => 'form_submission',                        'subject'   => 'New submission from {form_title}',                        'message'   => '{all_fields}',                        'from'      => '{admin_email}',                        'isActive'  => false,                    ),                ),                'confirmations'  => array(                    array(                        'id' => 0,                        'name' => 'Default Confirmation',                        'type' => 'message',                        'message' => 'Thanks for contacting us! We will get in touch with you shortly.',                        'isDefault' => true,                    ),                ),                'fields'         => array(                    array(                        'id' => '1',                        'label' => 'My Text',                        'type'  => 'text'                    )                ),            ),        );
JavaScript
1234567891011121314151617var form = {    title       : 'API Generated Form With Notification Sent to Specific Email Address',    description : 'This is the description for the form generated by the API',    labelPlacement  : 'top_label',    button      : {type : 'text'},    confirmations   : [        {id : '0', name : 'Default Confirmation', type : 'message', message : 'Thanks for contacting us! We will get in touch with you shortly.', isDefault : true}    ],    fields      : [        {id : '1', label : 'My Text', type : 'text'},        {id : '2', label : 'More Text', type : 'text'}    ],    notifications : [        {id : Math.floor(Math.random() * 1000), name : 'Admin Notification 1', to : '{admin_email}', toType : 'email', event : 'form_submission', subject : 'New submission from {form_title}', message : '{all_fields}', from : '{admin_email}', fromName : 'Administrator'},        {id : Math.floor(Math.random() * 1000), name : 'Admin Notification 2', to : '{admin_email}', toType : 'email', event : 'form_submission', subject : 'New submission from {form_title}', message : '{all_fields}', from : '{admin_email}', isActive : false}    ]};
Insert form with notification set to use an email field
The example below shows how to build the form array to have a notification which is sent to a specific email address field. Please see the article titled Notifications Object for more details about what may be included when building the notification array.
PHP
1234567891011121314151617181920212223242526272829303132333435363738394041424344$form = array(            array(                'title'          => 'API Generated Form With Notification Set to Field',                'description'    => 'This is the description for the form generated by the API',                'labelPlacement' => 'top_label',                'button'         => array(                    'type' => 'text'                ),                'notifications' => array(                    array(                        'id'        => uniqid( '0' ),                        'name'      => 'Admin Notification',                        'to'        => '2',                        'toType'    => 'field',                        'event'     => 'form_submission',                        'subject'   => 'New submission from {form_title}',                        'message'   => '{all_fields}',                        'from'      => '{admin_email}',                        'fromName'  => 'Administrator'                    ),                ),                'confirmations'  => array(                    array(                        'id' => uniqid(),                        'name' => 'Default Confirmation',                        'type' => 'message',                        'message' => 'Thanks for contacting us! We will get in touch with you shortly.',                        'isDefault' => true,                    ),                ),                'fields'         => array(                    array(                        'id' => '1',                        'label' => 'My Text',                        'type'  => 'text'                    ),                    array(                        'id' => '2',                        'label' => 'Email',                        'type'  => 'email'                    ),                ),            ),        );
JavaScript
1234567891011121314151617var form = {    title       : 'API Generated Form With Notification Sent to Specific Email Address',    description : 'This is the description for the form generated by the API',    labelPlacement  : 'top_label',    button      : {type : 'text'},    confirmations   : [        {id : '0', name : 'Default Confirmation', type : 'message', message : 'Thanks for contacting us! We will get in touch with you shortly.', isDefault : true}    ],    fields      : [        {id : '1', label : 'My Text', type : 'text'},        {id : '2', label : 'More Text', type : 'text'},        {id : '3', label : 'Email', type : 'email'}    ],    notifications : [        {id : Math.floor(Math.random() * 1000), name : 'Admin Notification 1', to : '3', toType : 'field', event : 'form_submission', subject : 'New submission from {form_title}', message : '{all_fields}', from : '{admin_email}', fromName : 'Administrator'}    ]};
Insert form with notification set to use routing
The example below shows how to build the form array to have a notification which is sent using routing rules. Please see the article titled Notifications Object for more details about what may be included when building the notification array.
PHP
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758$form = array(            array(                'title'          => 'API Generated Test Confirmations with new array 3',                'description'    => 'This is the description for the form generated by the API',                'labelPlacement' => 'top_label',                'button'         => array(                    'type' => 'text'                ),                'notifications' => array(                    array(                        'id'        => uniqid( '0' ),                        'name'      => 'Admin Notification',                        'toType'    => 'routing',                        'event'     => 'form_submission',                        'subject'   => 'New submission from {form_title}',                        'message'   => '{all_fields}',                        'from'      => '{admin_email}',                        'fromName'  => 'Administrator',                        'isActive'  => true,                        'routing'   => array(                                            array(                                                'fieldId'  => '1',                                                'operator' => 'is',                                                'value'    => 'test',                                                'email'    => '{admin_email}',                                            ),                                            array(                                                'fieldId'  => '2',                                                'operator' => 'is',                                                'value'    => '[email protected]',                                                'email'    => '{admin_email}',                                            )                        ),                    ),                ),                'confirmations'  => array(                    array(                        'id' => uniqid(),                        'name' => 'Default Confirmation',                        'type' => 'message',                        'message' => 'Thanks for contacting us! We will get in touch with you shortly.',                        'isDefault' => true,                    ),                ),                'fields'         => array(                    array(                        'id' => '1',                        'label' => 'My Text',                        'type'  => 'text'                    ),                    array(                        'id' => '2',                        'label' => 'Email',                        'type'  => 'email'                    ),                ),            ),        );
JavaScript
12345678910111213141516171819202122var form = {    title       : 'API Generated Form With Notification Sent to Specific Email Address',    description : 'This is the description for the form generated by the API',    labelPlacement  : 'top_label',    button      : {type : 'text'},    confirmations   : [        {id : '0', name : 'Default Confirmation', type : 'message', message : 'Thanks for contacting us! We will get in touch with you shortly.', isDefault : true}    ],    fields      : [        {id : '1', label : 'My Text', type : 'text'},        {id : '2', label : 'More Text', type : 'text'},        {id : '3', label : 'Email', type : 'email'}    ],    notifications : [        {id : Math.floor(Math.random() * 1000), name : 'Admin Notification', toType : 'routing', event : 'form_submission', subject : 'New submission from {form_title}', message : '{all_fields}', from : '{admin_email}', fromName : 'Administrator', isActive : true,        routing : [            {fieldId : '1', operator : 'is', value : 'test', email : '{admin_email}'},            {fieldId : '2', operator : 'is', value : '[email protected]', email : '{admin_email}'}        ]        }    ]};
Insert multiple forms
The example below inserts two new forms and displays the ids of the forms inserted.
PHP
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;} //set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'forms'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'POST', $route, $expires );$sig = calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wpdev/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; $form = array(    array(        'title'          => 'API Generated Form 1',        'description'    => 'This is the description for the form generated by the API',        'labelPlacement' => 'top_label',        'button'         => array(                                'type' => 'text'        ),        'confirmations'  => array(            array(                'id' => 0,                'name' => 'Default Confirmation',                'type' => 'message',                'message' => 'Thanks for contacting us! We will get in touch with you shortly.',                'isDefault' => true,            ),        ),        'fields'         => array(            array(                'id' => '1',                'label' => 'My Text',                'type'  => 'text'            )        ),    ),    array(        'title'          => 'API Generated Form 2',        'description'    => 'This is the description for the form generated by the API',        'labelPlacement' => 'top_label',        'button'         => array(            'type' => 'text'        ),        'confirmations'  => array(            array(                'id' => 0,                'name' => 'Default Confirmation',                'type' => 'message',                'message' => 'Thanks for contacting us! We will get in touch with you shortly.',                'isDefault' => true,            ),        ),        'fields'         => array(            array(                'id' => '1',                'label' => 'My Text',                'type'  => 'text'            )        ),    ),); //json encode array$form_json = json_encode( $form ); //retrieve data$response = wp_remote_request( $url, array( 'method' => 'POST', 'body' => $form_json ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); //echo $response['body'];  if( $body['status'] > 202 ){    $error = $body['response'];     //form insert failed, get error information    $error_code     = $error['code'];    $error_message  = $error['message'];    $error_data     = isset( $error['data'] ) ? $error['data'] : '';    $status     = "Code: {$error_code}. Message: {$error_message}. Data: {$error_data}.";    die( "Could not post forms. {$status}" );} $form_ids = $body['response'];$form_ids_created = '';foreach ( $form_ids as $form_id ){    $form_ids_created .= $form_id . '
';}echo 'The following form ids were created: ' . $form_ids_created . '
';
JavaScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
Update Forms
Update multiple forms
This example may be viewed in the REST API v1 article.
Delete Forms
This example may be viewed in the REST API v1 article.
Form Submissions
Complex Fields
Submit a list field that has a single column
This example shows how to create the input_values array for a list field (field 1) that has a single column. Each value in the array will be a separate row.
123456$values = array(            'input_values' => array(                                'input_1' => array('row1','row2'),                                'input_2' => 'test'                  )         );
Submit a list field that has multiple columns
This example shows how to create the input_values array for a list field (field 1) that has three columns. Each value in the array will fill up the columns for a row until starting on the columns for the next row. Use 」 if there is no value for a column in a particular row. The value 『test』 in the example starts a fourth row.
12345$values = array(            'input_values' => array(                                'input_1' => array('row1col1','row1col2','row1col3','row2col1','row2col2','row3col3','row3col1','row3col2','row3col3','test'),                  )        );
Submit a Multi-Select Field
This example shows how to create the input_values array for a multi-select field (field 1).
12345$values = array(            'input_values' => array(                                'input_1' => array('First Choice','Third Choice'),                  )        );
Pricing Fields
Single Product Field
This example shows how to create the input_values array for a Single Product Pricing field (field 1).
12345678$values = array(            'input_values' => array(                                'input_1_1' => 'test product', //product name                                'input_1_2' => '$5.00', //product price with formatting                                'input_1_3' => 1, //product quantity                               )          );
Single Product Field With Option
This examples shows how to create the input_values array for a product with an associated option (field id 2). The option needs to be in the format option name, pipe symbol, option price. This is the format whether the option is a drop down, check box, or radio button. When using check boxes, which allow multiple selections, you will need to reference the input fields a little differently. See the next example for this.
123456789$values = array(            'input_values' => array(                                'input_1_1' => 'test product', //product name                                'input_1_2' => '$5.00', //product price with formatting                                'input_1_3' => 1, //product quantity                                'input_2'   => 'Second Option|4' //option name|option price                               )          );
Option Field as a Checkbox
This example shows how to create the input_values array when the option associated to a product is a checkbox.
123456789$values = array(            'input_values' => array(                                'input_1_1' => 'test product', //product name                                'input_1_2' => '$5.00', //product price with formatting                                'input_1_3' => 1, //product quantity                                'input_2_1' => 'First Option|2', //option name|option price                                'input_2_3' => 'Third Option|6'                              )          );

Verifying Your Stripe Integration

Verifying Your Stripe Integration

Pre-RequisitesVerifying Your Integration

Pre-Requisites

Set Up The Stripe Add-On
Set Up a Stripe Compatible Form
Create a Feed for the Stripe Add-On

Verifying Your Integration
Now that your Stripe Add-On is integrated with Gravity Forms, you can test this integration through the submission of forms via Gravity Forms.

Make sure you have a visible Pricing Field with a valid Price in your form. You can ensure this by selecting Forms, hovering over your form and selecting Edit. Once in Form Editor view, double check your pricing field and make sure the price field has a value. The image below is an example of what your Pricing Field might look like. Ensure you have a Field Label and a Price and click Update Form.

Next select Preview from the form editor toolbar. This will open a new tab. Fill in all of the information prior to the Credit Card field.

The Credit Card field does not require real credit card information. Instead, you will need to visit Stripe to obtain a Test Credit Card Number.

Enter a test credit card number into the Card Number box. Fill in the Expiration Date, Security Code, and Cardholder Name fields. Note that the expiration date needs to be in the future to be valid.

Submit the form.

Once you have submitted the form, visit Stripe and navigate to your Dashboard.

If you selected either Products & Services or Subscription, you will see that your transaction has gone through under Payments.

If you selected Subscription as your transaction type and don』t see funds transferred under Payments, it is most likely because you have setup a Trial period for the Subscription. You can view the date and the amount your customer will be charged by selecting Customers and then selecting the individual customer you would like more information on.

If you can see that your transaction has processed either as a payment or a pending transaction, your Stripe Add-On has been successfully integrated with Gravity Forms! If you need more information on setting up your Stripe Add-On, visit the Stripe Add-On documentation.

Using the Polls Add-On

Using the Polls Add-On

Pre-RequisitesIntroductionSetup Your Poll FormAdding a Poll to your SiteDisplaying Your Poll Results

Pre-Requisites

Setting up the Polls the Add-On

Introduction

The Gravity Forms Polls Add-On allows you to quickly and easily deploy Polls on your website using the power of Gravity Forms. The Polls Add-On allows you to add fields to your form that ask users questions, capture their response, and show them the results of the poll when the form is submitted.

Polls are a great way to interact with your users and receive instant feedback. With the Gravity Forms Polls Add-On you are not limited to just a single poll question. You can add as many Poll Fields to your form as you』d like.

Setup Your Poll Form

This article reviews setting up a Poll Form in the Form Editor.

Adding a Poll to your Site

There are a few different ways you can add your already-configured poll to your page or post.

using a shortcodeusing a Poll Block, chosen from within WordPress block editor. See this article.using a Poll Widget to insert the poll into your sidebar in site themes that support it. Refer to this WordPress page on widgets.

This article provides an in-depth example of adding a poll to your WordPress website.

Additionally, you can use the Poll specific merge tags to display poll fields or results, or just a standard Gravity Form block and choose a poll form.

Due to the way they are implemented, each presentation option may not offer the full suite of settings. For most use cases, the Poll Block is the best option, as it has a full suite of controls and a variety of display options. See the article linked below for some more details.

Displaying Your Poll Results

You have a few options on how you display poll results to site visitors and poll submitters, depending on the method you used to insert the poll on your page. Refer to the article Displaying your poll results to visitors for details.

REST API v1 Guide

REST API v1 Guide

IntroductionRequirementsSecurityAuthenticationWordPress Cookie AuthenticationAuthentication for External applicationsAuthorizationResponseStatus CodesErrorsFile extension supportFormsGET /formsGET /forms/[Form IDs]POST /formsPUT /forms/[Form ID]DELETE /forms/[Form IDs]Form SubmissionsPOST /forms/[Form ID]/submissionsEntriesGET /entriesGET /entries/[Entry ID]GET /forms/[Form ID]/entriesGET /forms/[Form ID]/entries/[Entry ID]/fields/[Field ID]Querystring Parameters for Retrieval RoutesPagingSortingSearch CriteriaField FiltersPOST /entriesPOST /forms/[Form ID]/entriesPUT /entries/[Entry ID]PUT /entriesDELETE /entries/[Entry ID]ResultsGET /forms/[Form ID]/resultsToolsSample REST API v1 ClientPHP WrapperURL generator & testerOther resources

Introduction
The REST API v1, formerly called the Web API, allows developers to create, read, update and delete forms, entries and results over HTTP loosely following REST-style principles.
The URI defines the resource and the HTTP method defines the operation.

Use the GET HTTP method to read data
Use the POST HTTP method to create/add data
Use the PUT HTTP method to update data
Use the DELETE HTTP method to delete data

The base URI of the Web API is 「gravityformsapi」. So the URL would be, for example:
1http://mydomain.com/gravityformsapi
or, alternatively, if the WordPress installation is in a sub-directory:
1http://mydomain.com/wordpress/gravityformsapi/
The resources are defined in the URL after the base, like this:
123http://mydomain.com/gravityformsapi/forms http://mydomain.com/gravityformsapi/entries
Keys, or object IDs are sent in the next part of the URI, like this:
123http://mydomain.com/gravityformsapi/forms/1 http://mydomain.com/gravityformsapi/entries/543
Some resources also support sub-resources, for example:
123http://mydomain.com/gravityformsapi/forms/1/results http://mydomain.com/gravityformsapi/forms/1/entries
TIP:
Most of the endpoints are simply wrappers for their GFAPI counterparts. So if you have trouble getting the REST API v1 to work it can helpful to debug using the PHP equivalent.
Requirements
The REST API v1 requires 「pretty」 permalinks to be enabled. Please ensure that the permalink setting is NOT set to the default (http://mydomain.com/?p=123) before trying to use the REST API v1. Any setting other than the default will be fine.
The REST API v1 is activated on the API settings tab. You can leave the default keys or generate new ones.
Security
In addition to the security measures enforced by the REST API v1, it』s strongly advisable to implement SSL for the WordPress site (beyond the scope of this API).
Authentication
There are two types of authentication:
Are you a plugin/theme running on the site? Use WordPress cookie authentication.
Are you a desktop/web/mobile client accessing the site externally? Use signatures.
All endpoints require authentication with the exception of the POST forms/[ID]/submissions end point.
WordPress Cookie Authentication
Cookie authentication is the basic authentication method included with WordPress. When users log in, this sets up the cookies, so plugin and theme developers need only to have a logged-in user.
However, the Gravity Forms REST API v1 uses nonces to avoid CSRF issues. This prevents other sites from forcing you to perform actions without explicitly intending to do so.
The REST API v1 uses nonces with the action set to gf_api. These are then be passed to the API with each request via the _gf_json_nonce parameter in the URL.
Authentication for External applications
All requests from external applications are authenticated by checking an expiring signature. This is similar to the approach used by Amazon to secure access to their S3 Storage API. Once authenticated, standard WordPress and Gravity Forms role-based authorization is used to ensure that the API request is allowed to be fulfilled.
Each request at a minimum must include the following 3 query parameters:

api_key – The public API key defined on the settings page e.g. 「1234」
expires – Expiration date for the request expressed as a UNIX timestamp in seconds e.g. 1369749344
signature – A URL-encoded, base64 HMAC-SHA1 hash of a colon separated string following this structure:
{api_key}:{http method}:{route}:{expires}
e.g. 1234:GET:forms/1/entries:1369749344
The signature for this request using the private key of 「abcd」 is uJEnk0EoQ4d3iinjFMBrBzZfH9w%3D

Complete example request:
12GEThttp://mydomain.com/gravityformsapi/forms/25?api_key=1234&signature=PueNOtbfUe%2BMfClAOi2lfq%2BHLyo%3D&expires=1369749344
Sample code for generating signatures:
PHP
12345678910111213141516
JavaScript
WARNING: This sample JavaScript is not secure and it』s not intended to be used on production sites. Never send your private key to the browser. Consider using WordPress cookie authentication instead.
1234567891011121314151617181920212223
C#
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152using System;using System.Web;using System.Security.Cryptography;using System.Text; namespace GravityForms{    public class Sample    {        public static GenerateSignature()        {            string publicKey = "1234";            string privateKey = "abcd";            string method = "GET";            string route = "forms/1/entries";            string expires = Security.UtcTimestamp(new TimeSpan(0,1,0));            string stringToSign = string.Format("{0}:{1}:{2}:{3}", publicKey, method, route, expires);               var sig = Security.Sign(stringToSign, privateKey);            Console.WriteLine(sig);        }    }     public class Security    {         public static string UrlEncodeTo64(byte[] bytesToEncode)        {            string returnValue                = System.Convert.ToBase64String(bytesToEncode);             return HttpUtility.UrlEncode(returnValue);        }         public static string Sign(string value, string key)        {            using (var hmac = new HMACSHA1(Encoding.ASCII.GetBytes(key)))            {                return UrlEncodeTo64(hmac.ComputeHash(Encoding.ASCII.GetBytes(value)));            }        }         public static int UtcTimestamp( TimeSpan timeSpanToAdd)        {            TimeSpan ts = (DateTime.UtcNow.Add(timeSpanToAdd) - new DateTime(1970,1,1,0,0,0));            int expires_int =  (int) ts.TotalSeconds;            return expires_int;        }    }}
Authorization
The REST API v1 adds an additional layer of security by executing the request on behalf of the user account defined in the account impersonation setting on the settings tab. Roles and capabilities for role-based authorization can be configured using the Members plugin.
The number of users available on the settings page is set to a maximum of 200. This can be changed using the gform_webapi_get_users_settings_page filter.
Response
The response body will always be a JSON object containing a status code and the result of the request. The HTTP status code in the header will always be 200 regardless of the result so it』s important to check for the status code in the response body to determine the success or failure of the request.
So, for example, if a non-existent form is requested, the raw response body would be the following:
1234{    "status": 404,    "response": "Not found"}
A successful request for a form would look like this:
12345678{  "status": 200,  "response": {    "title": "My Form",    "description": "This is my form",    ... snip ...    }}
TIP: successful requests will return a status of 200, 201 or 202. Anything above 202 signifies an error. See the section below on status codes for further details.
Status Codes
Although the HTTP status code in the response header will always be 200, the status code in the response body will follow the standard HTTP status code definitions:

Successful requests will generate either a 200 (OK) or 201 (resource created) status code.

Accepted but unfinished requests will generate a 202 (accepted) status code.

Illegal or illogical requests, will result in a 400 (bad request) status code.

Unauthenticated or unauthorized requests will receive the 401 (not authorized) status code.

Requests for non-existent resources will receive a 404 (not found) status code.

Server errors will generate a 500 (server error) status code.

Unsupported requests will receive the 501 (Not implemented) status code.

Errors
When the request is not successful, the status code will be greater than 202. When appropriate, and when available, additional information about the error will be returned in the response element in the following format:

code: a code identifying further details about the error.
message: a description of the error
data: additional data pertaining to the failure. e.g. the error message generated by MySQL Server.

Example of an error message after trying to update an entry without a form ID:
1234567{  "status": 400,  "response": {    "code": "empty_form_id",    "message": "The form ID must be specified"    }}
Example of an error when trying to update an array of entries but one of the entries could not be found:
12345678{  "status": 404,  "response": {    "code": "not_found",    "message": "Entry with ID 414 not found",    "data": 414    }}
File extension support
For the sake of clarity, forward compatibility and hook-based extensibility, a file extension is supported as part of the url. Currently .json is the only supported extension. This means that both of the following GET requests receive identical responses (the entry object):
1http://mydomain.com/wordpress/gravityformsapi/forms/14/entries.json
1http://mydomain.com/wordpress/gravityformsapi/forms/14/entries
Forms
For more detailed examples of how to work with forms, go to REST API v1 Examples.
GET /forms
Returns a list of all ACTIVE forms along with its entry count.

URI: /gravityformsapi/forms
Capability: gravityforms_edit_forms
Output: JSON string with the id, title, entry count for each form:
123456789101112{    "1": {        "id": "1",        "title": "test form",        "entries": "15"    },    "2": {        "id": "2",        "title": "test form 2",        "entries": "26"    }}

Example:
The example below retrieves all ACTIVE forms:

PHP
123456789101112131415161718192021222324252627282930313233343536373839404142//set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'forms'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'GET', $route, $expires );$sig = calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wp/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; //retrieve data$response = wp_remote_request( urlencode( $url ), array( 'method' => 'GET' ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    die( "Could not retrieve forms." );} //forms retrieved successfully$forms = $body['response']; //To access each form, loop through the $forms array.foreach ( $forms as $form ){    $form_id     = $form['id'];    $form_title  = $form['title'];    $entry_count = $form['entries'];} function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;}
JavaScript
WARNING: This sample JavaScript is not secure and it』s not intended to be used on production sites. Never send your private key to the browser. Consider using WordPress cookie authentication instead.
123456789101112131415161718192021222324252627282930313233343536373839404142
Sample JSON output from the code above:
1{"status":200,"response":{"20":{"id":"20","title":"Captcha 2","entries":"35"},"15":{"id":"15","title":"Credit Card Form","entries":"24"},"5":{"id":"5","title":"Custom Contact Form","entries":"0"},"24":{"id":"24","title":"Drop Down Test Alert Conditional Logic","entries":"0"},"1":{"id":"1","title":"Freshbooks","entries":"28"},"27":{"id":"27","title":"List Field","entries":"1"},"11":{"id":"11","title":"PayPal Standard","entries":"8"},"12":{"id":"12","title":"PayPal Standard - No Other Add-Ons","entries":"4"},"13":{"id":"13","title":"PayPal Standard With Zapier Not Delayed","entries":"1"},"18":{"id":"18","title":"Post Body Test with Text Editor","entries":"2"},"14":{"id":"14","title":"Products","entries":"39"},"19":{"id":"19","title":"Recaptcha","entries":"5"},"25":{"id":"25","title":"reCaptcha Multi-Page Test Page 1","entries":"2"},"26":{"id":"26","title":"reCaptcha Test Page 2","entries":"2"},"28":{"id":"28","title":"Test Form","entries":"21"},"21":{"id":"21","title":"Test reCaptcha 2","entries":"0"},"16":{"id":"16","title":"Textarea Test With Editor","entries":"2"},"2":{"id":"2","title":"Untitled Form","entries":"0"},"3":{"id":"3","title":"User Signup","entries":"1"},"4":{"id":"4","title":"User Signup - Update","entries":"1"},"29":{"id":"29","title":"_Test Recaptcha Secure Token","entries":"6"}}}
GET /forms/[Form IDs]
Returns a Form object. Multiple forms may be requested by separating the IDs by semicolons.

URI: /gravityformsapi/forms/1 or /gravityformsapi/forms/1;3;6
Capability: gravityforms_edit_forms
Output: A JSON string containing the form or forms
Notes: If a form does not exist for a form id provided, false is returned for that form. The entry count is not included.
Example:
The example below retrieves the forms with ids 1000, 1, 14, 28, 29. Form id 1000 does not exist so false is returned for that form.

PHP
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647//set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'forms/1000;1;14;28;29'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'GET', $route, $expires );$sig = calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wp/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; //retrieve data$response = wp_remote_request( urlencode( $url ), array( 'method' => 'GET' ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    die( "Could not retrieve forms." );} //forms retrieved successfully$forms = $body['response']; //To access each form, loop through the $forms array.foreach ( $forms as $form ){     $form_id     = $form['id'];     $form_title  = $form['title'];      $fields = $form['fields'];     foreach ( $fields as $field ){          $field_id = $field['id'];          $field_label = $field['label'];     }} function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;}
JavaScript
WARNING: This sample JavaScript is not secure and it』s not intended to be used on production sites. Never send your private key to the browser. Consider using WordPress cookie authentication instead.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
Sample JSON output from the code above:
1{"status":200,"response":{"1000":false,"28":{"title":"Test Form","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"name","id":1,"label":"Name","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","nameFormat":"advanced","inputs":[{"id":"1.2","label":"Prefix","name":"","choices":[{"text":"Mr.","value":"Mr.","isSelected":false,"price":""},{"text":"Mrs.","value":"Mrs.","isSelected":false,"price":""},{"text":"Miss","value":"Miss","isSelected":false,"price":""},{"text":"Ms.","value":"Ms.","isSelected":false,"price":""},{"text":"Dr.","value":"Dr.","isSelected":false,"price":""},{"text":"Prof.","value":"Prof.","isSelected":false,"price":""},{"text":"Rev.","value":"Rev.","isSelected":false,"price":""}],"isHidden":true,"inputType":"radio"},{"id":"1.3","label":"First","name":""},{"id":"1.4","label":"Middle","name":"","isHidden":true},{"id":"1.6","label":"Last","name":""},{"id":"1.8","label":"Suffix","name":"","isHidden":true}],"formId":28,"pageNumber":1,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","adminOnly":false,"noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","displayOnly":""},{"type":"text","id":2,"label":"Testing","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","inputs":null,"formId":28,"pageNumber":1,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","adminOnly":false,"noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","displayOnly":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false},{"type":"text","id":3,"label":"Text 2","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","inputs":null,"labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"inputMask":false,"inputMaskValue":"","allowsPrepopulate":false,"formId":28,"pageNumber":1,"description":"","inputType":"","cssClass":"","inputName":"","adminOnly":false,"noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":""}],"version":"1.9.10.12","id":28,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"notifications":{"557b09f4495a0":{"id":"557b09f4495a0","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}},"confirmations":{"557b09f457c1b":{"id":"557b09f457c1b","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}},"is_active":"1","date_created":"2015-06-12 16:33:56","is_trash":"0"}}}
POST /forms
Creates new forms using the given form objects

URI: /gravityformsapi/forms
Capability: gravityforms_create_forms
Input: An array of valid form objects to create. If the ID of the form is included in the form object, then it will be ignored.
Output: A JSON string containing an array of Form IDs, one for each form created, in the order in which the forms were processed.
Potential Errors:
If the forms object is not an array, an 『invalid』 error will be output:
1{"status":400,"response":{"code":"invalid","message":"Invalid form objects"}}
If the form title is not provided, a 『missing_title』 error will be output:
1{"status":400,"response":{"code":"missing_title","message":"The form title is missing"}}
If there is a problem inserting the form in the database, the following message is displayed, along with the applicable SQL error, if one exists:
1{"status":error code,"response":{"code":"insert_form_error","message":"There was a problem while inserting the form","data":"sql statement"}

Example:

PHP
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374//set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'forms'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'POST', $route, $expires );$sig = calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wp/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; $forms = array(       array(         'title'          => 'API Generated 10',         'description'    => 'This is the description for the form generated by the API',         'labelPlacement' => 'top_label',         'button'         => array(                   'type' => 'text'         ),        'confirmations'   => array(                   array(                    'id' => 0,                    'name' => 'Default Confirmation',                    'type' => 'message',                    'message' => 'Thanks for contacting us! We will get in touch with you shortly.',                    'isDefault' => true,                   ),             ),        'fields'          => array(                   array(                    'id' => '1',                    'label' => 'My Text',                    'type'  => 'text'                   )            ,      ),    ); //json encode array$form_json = json_encode( $forms ); //retrieve data$response = wp_remote_request( urlencode( $url ), array( 'method' => 'POST', 'body' => $form_json ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    $error = $body['response'];    //form insert failed, get error information    $error_code     = $error['code'];    $error_message  = $error['message'];    $error_data     = isset( $error['data'] ) ? $error['data'] : '';    $status     = "Code: {$error_code}. Message: {$error_message}. Data: {$error_data}.";    die( "Could not post forms. {$status}" );} $form_ids = $body['response'];$form_ids_created = 'The following form ids were created:
';foreach ( $form_ids as $form_id ){    $form_ids_created .= $form_id . '
';} function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;}
JavaScript
WARNING: This sample JavaScript is not secure and it』s not intended to be used on production sites. Never send your private key to the browser. Consider using WordPress cookie authentication instead.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
Sample JSON output for two forms inserted.
1{"status":201,"response":[47,48]}
PUT /forms/[Form ID]
Updates the form with a given ID, or if an ID is not provided in the route, updates the form(s) using the provided id(s) in the form array.
NOTE: To perform an update, the form object for the form being updated needs to first be retrieved because the entire Form Object must be sent to the API. If the entire form object is not sent, fields not included will be removed, along with other information.

URI: /gravityformsapi/forms/[Form ID] or /gravityformsapi/forms
Capability: gravityforms_edit_forms
Input: A JSON string representation of the form object(s). If the ID of the form is included in the form object then it will be overwritten with the form ID supplied in the request URI (if there is one).
Output: A localized message describing the result: 「Form(s) updated successfully」
Potential Errors:
If the form object is not an array, an 『invalid』 error will be output:
1{"status":400,"response":{"code":"invalid","message":"Invalid form object"}}
If the form id is not provided in the route and not provided in the individual form array, a 『missing_form_id』 error will be output:
1{"status":400,"response":{"code":"missing_form_id","message":"Missing form id"}}
If the form id provided cannot be found in the database, a 『not_found』 error will be output:
1{"status":404,"response":{"code":"not_found","message":"Form not found"}}
If there is a problem updating the form in the database, the following message is displayed, along with the applicable SQL error, if one exists:
1{"status":error code,"response":{"code":"error_updating_form","message":"Error updating form","data":"sql statement"}
If there is a problem updating a confirmation in the database, the following message is displayed, along with the applicable SQL error, if one exists:
1{"status":error code,"response":{"code":"error_updating_confirmations","message":"Error updating form confirmations","data":"sql statement"}
If there is a problem updating a notification in the database, the following message is displayed, along with the applicable SQL error, if one exists:
1{"status":error code,"response":{"code":"error_updating_notifications","message":"Error updating form notifications","data":"sql statement"}
If there is a problem updating the form title or the form』s active status in the database, the following message is displayed, along with the applicable SQL error, if one exists:
1{"status":error code,"response":{"code":"error_updating_title","message":"Error updating title","data":"sql statement"}

Example:
The example below updates forms with the ids 83,84:

PHP
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101//set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route to retrieve forms that will be updated$route          = 'forms/84;83';$expires        = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'GET', $route, $expires );$sig            = self::calculate_signature( $string_to_sign, $private_key );$url            = 'http://localhost/wp.dev/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; //retrieve data$response = wp_remote_request( $url, array( 'method' => 'GET' ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ) {    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if ( $body['status'] > 202 ) {    die( "Could not retrieve forms." );} //forms retrieved successfully$forms = $body['response']; //set route for updating$route = 'forms'; //creating request URL$expires        = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'PUT', $route, $expires );$sig            = self::calculate_signature( $string_to_sign, $private_key );$url            = 'http://localhost/wp.dev/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; foreach ( $forms as &$form ) {    //loop through forms and update data    //use the & so form object is updated in loop    if ( $form['id'] == '83' ){        //update the title for the form, no other changes        $form['title'] = 'Title Updated by API';         //update confirmations        $form['confirmations'] = array(                array(                    'id'   => 0,                    'name' => 'Default Confirmation',                    'type' => 'message',                    'message' => 'Thanks for contacting us! We will get in touch with you shortlyXXX.',                    'isDefault' => true,                ),        );        break;    }     if ( $form['id'] == '84' ) {        foreach ( $form['fields'] as &$field ) {            //use the & so field object is updated in loop            //update the field label and drop down choices, leave other fields alone            if ( $field['id'] == '2' ) {                $field['label']   = 'Updated from API';                $field['choices'] = array(                    array(                        'text'  => 'Bulk Item Pickup',                        'value' => '3B6D4BD9B6FF',                    ),                    array(                        'text'  => 'General Repair',                        'value' => 'E26618F9E10A'                    )                );            }        }    }} //json encode array$form_json = json_encode( $forms ); //retrieve data$response = wp_remote_request( urlencode( $url ), array( 'method' => 'PUT', 'body' => $form_json ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    $error = $body['response'];     //form insert failed, get error information    $error_code     = $error['code'];    $error_message  = $error['message'];    $error_data     = isset( $error['data'] ) ? $error['data'] : '';    $status         = "Code: {$error_code}. Message: {$error_message}. Data: {$error_data}.";    die( "Could not update forms. {$status}" );}
JavaScript
WARNING: This sample JavaScript is not secure and it』s not intended to be used on production sites. Never send your private key to the browser. Consider using WordPress cookie authentication instead.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
Sample output from the code above:
1{"status":200,"response":"Forms updated successfully"}
DELETE /forms/[Form IDs]
Deletes the forms with the given IDs

URI: /gravityformsapi/forms/[Form ID or Form IDs]
12/gravityformsapi/forms/1/gravityformsapi/forms/1;4;8

Output: A localized message describing the results e.g. Forms deleted successfully: 2
Notes: If a list of form ids is provided, and a form in the list cannot be found, processing ends and the rest of the forms are not deleted.
Potential Errors:
If a form in the list to be deleted is not found in the database, the following message is displayed:
1{"status":404,"response":{"code":"not_found","message":"Form with id: 67 not found","data":"67"}}

Example:

PHP
123456789101112131415161718192021222324252627282930313233//set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'forms/67;68'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'DELETE', $route, $expires );$sig = self::calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wp/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; //retrieve data$response = wp_remote_request( urlencode( $url ), array( 'method' => 'DELETE' ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    $error = $body['response'];     //form delete failed, get error information    $error_code     = $error['code'];    $error_message  = $error['message'];    $error_data     = isset( $error['data'] ) ? $error['data'] : '';    $status         = "Code: {$error_code}. Message: {$error_message}. Data: {$error_data}.";    die( "Could not delete forms. {$status}" );}
JavaScript
WARNING: This sample JavaScript is not secure and it』s not intended to be used on production sites. Never send your private key to the browser. Consider using WordPress cookie authentication instead.
123456789101112131415161718192021222324252627282930313233
Sample output from the code above:
1{"status":200,"response":"Forms deleted successfully: 2"}
Form Submissions
For more detailed examples of how to work with form submissions, go to REST API v1 Examples.
POST /forms/[Form ID]/submissions
Submits a form. Use this function to send input values through the complete form submission process.
Supports field validation, notifications, confirmations, multiple-pages, save & continue and all the filters and actions that fire throughout the submission process.
This is exactly equivalent to submitting a form rendered by a Gravity Forms shortcode. The input names expected by this function are identical to the input names found in the form markup so if you have any doubts about the name of an input, just check the form preview. This is a wrapper for the GFAPI::submit_form() function.
This is the only endpoint which does not require authentication.

URI: /gravityformsapi/forms/[Form ID]/submissions
Input: A JSON object containing each of the name-value pairs.
12345678{    "input_values": {        "input_1": "Hello",        "input_2_3": "John",        "input_2_6": "Smith",        "input_4": "My paragraph"    }}

Output: A JSON object containing the result.
Example in the case of a successful submission:
123456{    "is_valid": true,    "page_number": 0,    "source_page_number": 1,    "confirmation_message": "this is the confirmation [snipped]"}

Example in the case of a validation failure:
12345678910{    "is_valid": false,    "validation_messages": {                "2": "This field is required. Please enter the first and last name.",                "3": "Please enter a valid email address."    },    "page_number": 1,    "source_page_number": 1,    "confirmation_message": ""}
* Potential Errors:
If the form id provided cannot be found (doesn』t exist, is inactive, is in the trash), a 「form_not_found」 error will be output:
1{"status":400,"response":{"code":"form_not_found","message":"Your form could not be found"}}
If input_values is empty, a bad request error will be output:
1{"status":400,"response":"Bad request"}
* Notes:
You cannot upload files using this method. To send pricing fields, you must check the setting 「Allow field to be populated dynamically」.

Example:
The example below submits form id 96 with field id 1 (input_1) set to 「Testing」.

PHP
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455//set route$route = 'forms/96/submissions'; //creating request URL$url = 'http://localhost/wpdev/gravityformsapi/' . $route; $values = array(        'input_values' => array(                    'input_1'   => 'Testing',        )); //json encode array$values_json = json_encode( $values ); //retrieve data$response = wp_remote_request( urlencode( $url ), array( 'method' => 'POST', 'body' => $values_json ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    $error = $body['response'];     if ( is_array( $error ) ) {        //get error information        $error_code     = $error['code'];        $error_message  = $error['message'];        $error_data     = isset( $error['data'] ) ? $error['data'] : '';        $status         = "Code: {$error_code}. Message: {$error_message}. Data: {$error_data}.";        die( "Could not complete form submission. {$status}" );    }    else{        die( $error );    }}else{    if ( $body['response']['is_valid' ] ){        echo $body['response']['confirmation_message'];    }    else{        $form = GFFormsModel::get_form_meta(96);        $result = '';        $validation_messages = $body['response']['validation_messages'];        foreach ( $validation_messages as $id => $message ){            $field = GFFormsModel::get_field( $form, $id );            $result .= 'Field ' . GFFormsModel::get_label( $field )  . ' (id: ' . $id . ') - ' . $message . '
';        }        echo $result;    }}
JavaScript
WARNING: This sample JavaScript is not secure and it』s not intended to be used on production sites. Never send your private key to the browser. Consider using WordPress cookie authentication instead.
12345678910111213141516171819202122232425262728293031323334
Entries
For more detailed examples of how to work with entries, go to REST API v1 Examples.
GET /entries
Returns the latest entries across all forms.

URI: /gravityformsapi/entries
Capability: gravityforms_view_entries
Output: A JSON string containing a collection of entry objects
Notes: Use the Paging parameter to limit the number of entries otherwise you may find the database times out. On most servers we have found the optimum page size to be 200.
Parameters:

Paging – Controls the number of entries retrieved per page and allows paging to be implemented
Sorting – Allows entries to be sorted by a specific field and to be sorted ascending/descending.
Search – Allows entries to be filtered by search criteria and field filters.

Example:
The example below retrieves all entries across all forms with paging set to be 5 entries per page:

PHP
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748//set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'entries'; //set paging properties.$page_size = 5; //five items will be returned$offset = 5;    //second page of results will be returned (first page had results 0-4, this needs to start with result 5 to see second page) //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'GET', $route, $expires );$sig = calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wp/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires . '&paging[page_size]=' . $page_size . '&paging[offset]=' . $offset; //retrieve data$response = wp_remote_request( urlencode( $url ), array( 'method' => 'GET' ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    $error = $body['response'];    die( "Could not retrieve entries. Code: {$error['code']}. Message: {$error['message']}. Data: {$error['data']}." );} //entries retrieved successfully$entries         = $body['response']['entries'];$total           = $body['response']['total_count']; //Takes into account all entries including ones outside the current retrieved page. //To access each entry, loop through the $entries array.foreach ( $entries as $entry ){    $entry_id = $entry['id'];    $data_created = $entry['date_created'];    $field_1 = $entry['1']; //Data for field with ID = 1.} function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;}
JavaScript
WARNING: This sample JavaScript is not secure and it』s not intended to be used on production sites. Never send your private key to the browser. Consider using WordPress cookie authentication instead.
123456789101112131415161718192021222324252627282930313233343536373839404142
Sample JSON output from the code above:
1{"status":200,"response":{"total_count":"155","entries":[{"id":"163","form_id":"28","date_created":"2015-07-01 20:03:09","is_starred":0,"is_read":1,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":null,"is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"spam","1.3":"July","1.6":"First","2":"test","1.2":"","1.4":"","1.8":"","3":""},{"id":"162","form_id":"28","date_created":"2015-06-24 20:01:31","is_starred":0,"is_read":0,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":null,"is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"trash","1.3":"d5","1.6":"d5","2":"d5","1.2":"","1.4":"","1.8":"","3":""},{"id":"161","form_id":"28","date_created":"2015-06-24 20:01:06","is_starred":0,"is_read":0,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":null,"is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"d4","1.6":"d4","2":"d4","1.2":"","1.4":"","1.8":"","3":""},{"id":"157","form_id":"28","date_created":"2015-06-15 22:43:23","is_starred":0,"is_read":1,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":"","is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Lee","1.6":"Draven","2":"brandonlee","3":"The Crow","1.2":"","1.4":"","1.8":""},{"id":"156","form_id":"28","date_created":"2015-06-15 22:42:36","is_starred":0,"is_read":1,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":"","is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Ellen","1.6":"Ripley","2":"aliens","1.2":"","1.4":"","1.8":"","3":""}]}}
GET /entries/[Entry ID]
Returns the entry that matches the given entry id

URI: /gravityformsapi/entries/[Entry ID]
Capability: gravityforms_view_entries
Output: A JSON string containing the entry object
Potential Errors:
If the entry is not found, a 『not_found』 error will be output:
1{"status":404,"response":{"code":"not_found","message":"Entry with id 1000 not found","data":"1000"}}

Example:
The example below retrieves the entry with id 146:

PHP
12345678910111213141516171819202122232425262728293031323334353637383940//set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'entries/146'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'GET', $route, $expires );$sig = calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wp/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; //retrieve data$response = wp_remote_request( urlencode( $url ), array( 'method' => 'GET' ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    $error = $body['response'];    die( "Could not retrieve entry. Code: {$error['code']}. Message: {$error['message']}. Data: {$error['data']}." );} //entry retrieved successfully$entry = $body['response']; $entry_id = $entry['id'];$data_created = $entry['date_created'];$field_1 = $entry['1']; //Data for field with ID = 1. function calculate_signature( $string, $private_key ) {  $hash = hash_hmac( 'sha1', $string, $private_key, true );  $sig = rawurlencode( base64_encode( $hash ) );  return $sig;}
JavaScript
WARNING: This sample JavaScript is not secure and it』s not intended to be used on production sites. Never send your private key to the browser. Consider using WordPress cookie authentication instead.
12345678910111213141516171819202122232425262728293031323334353637
Sample JSON output from the code above:
1{"status":200,"response":{"id":"146","form_id":"28","date_created":"2015-06-15 22:43:23","is_starred":1,"is_read":0,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":"","is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Eric","1.6":"Draven","2":"brandonlee","3":"Rapid Fire","1.2":"","1.4":"","1.8":""}}
GET /forms/[Form ID]/entries
Returns the latest entries for the given Form ID.

URI: /gravityformsapi/forms/[form ID]/entries
Capability: gravityforms_view_entries
Output: A JSON string containing a collection of entry objects
Parameters:

Paging – Controls the number of entries retrieved per page and allows paging to be implemented
Sorting – Allows entries to be sorted by a specific field and to be sorted ascending/descending.
Search – Allows entries to be filtered by search criteria and field filters.

Example:
The example below retrieves entries for a form. Only 10 entries are retrieved since Paging is not used.

PHP
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253//set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'forms/28/entries'; //creating request URL//set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'forms/28/entries'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'GET', $route, $expires );$sig = calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wp/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; //retrieve data$response = wp_remote_request( urlencode( $url ), array( 'method' => 'GET' ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    //echo (wp_remote_retrieve_body( $response ) );    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    $error = $body['response'];    die( "Could not retrieve entries. Code: {$error['code']}. Message: {$error['message']}. Data: {$error['data']}." );} //entries retrieved successfully$entries         = $body['response']['entries'];$total           = $body['response']['total_count']; //Takes into account all entries including ones outside the current retrieved page. //To access each entry, loop through the $entries array.foreach ( $entries as $entry ){    $entry_id = $entry['id'];    $data_created = $entry['date_created'];    $field_1 = $entry['1']; //Data for field with ID = 1.} function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;}
JavaScript
WARNING: This sample JavaScript is not secure and it』s not intended to be used on production sites. Never send your private key to the browser. Consider using WordPress cookie authentication instead.
1234567891011121314151617181920212223242526272829303132333435363738
The response from this example will look like the following if successful:
1{"status":200,"response":{"total_count":"13","entries":[{"id":"162","form_id":"28","date_created":"2015-06-24 20:01:31","is_starred":0,"is_read":0,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":null,"is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"d5","1.6":"d5","2":"d5","1.2":"","1.4":"","1.8":"","3":""},{"id":"161","form_id":"28","date_created":"2015-06-24 20:01:06","is_starred":0,"is_read":0,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":null,"is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"d4","1.6":"d4","2":"d4","1.2":"","1.4":"","1.8":"","3":""},{"id":"157","form_id":"28","date_created":"2015-06-15 22:43:23","is_starred":0,"is_read":1,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":"","is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Eric","1.6":"Draven","2":"brandonlee","3":"The Crow","1.2":"","1.4":"","1.8":""},{"id":"156","form_id":"28","date_created":"2015-06-15 22:42:36","is_starred":0,"is_read":1,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":"","is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Ellen","1.6":"Ripley","2":"aliens","1.2":"","1.4":"","1.8":"","3":""},{"id":"155","form_id":"28","date_created":"2015-06-15 22:42:15","is_starred":0,"is_read":0,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":null,"is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"James","1.6":"Kirk","2":"captain","1.2":"","1.4":"","1.8":"","3":""},{"id":"154","form_id":"28","date_created":"2015-06-15 22:41:56","is_starred":0,"is_read":0,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":null,"is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Jean-Luc","1.6":"Picard","2":"captain","1.2":"","1.4":"","1.8":"","3":""},{"id":"153","form_id":"28","date_created":"2015-06-15 22:41:33","is_starred":0,"is_read":0,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":null,"is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Wesley","1.6":"Crusher","2":"ensign","1.2":"","1.4":"","1.8":"","3":""},{"id":"152","form_id":"28","date_created":"2015-06-15 22:41:07","is_starred":0,"is_read":0,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":null,"is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Sam","1.6":"Winchester","2":"computer","1.2":"","1.4":"","1.8":"","3":""},{"id":"151","form_id":"28","date_created":"2015-06-15 22:40:48","is_starred":0,"is_read":0,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":null,"is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Dean","1.6":"Winchester","2":"supernatural","1.2":"","1.4":"","1.8":"","3":""},{"id":"150","form_id":"28","date_created":"2015-06-15 22:40:29","is_starred":0,"is_read":0,"ip":"::1","source_url":"http://localhost/wp/?gf_page=preview&id=28","post_id":null,"currency":"USD","payment_status":null,"payment_date":null,"transaction_id":null,"payment_amount":null,"payment_method":null,"is_fulfilled":null,"created_by":"1","transaction_type":null,"user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0","status":"active","1.3":"Rupert","1.6":"Giles","2":"sunnydale","1.2":"","1.4":"","1.8":"","3":""}]}}
If no entries are located for the specified form, the response will look like the following:
1{"status":200,"response":{"total_count":"0","entries":[]}}
GET /forms/[Form ID]/entries/[Entry ID]/fields/[Field ID]
Returns the specified entry property/properties for the specified entry/entries.

URI:/gravityformsapi/entries/[Entry ID]/fields/[Field ID or entry meta key]
123456//retrieve field id 1.3 for entry id 146http://[your_domain]/gravityformsapi/entries/146/fields/1.3 //retrieve field ids 1.3 and 1.6 with fields id, form_id, date_created, is_starred//for entry ids 146 and 147http://[your_domain]/gravityformaspi/entries/146;147/fields/id;form_id;date_created;is_starred;1.3;1.6;

Capability:gravityforms_view_entries
Output: A JSON string containing the filtered entry object
Potential Errors:
If the entry is not found, a 『not_found』 error will be output. If multiple entries are being retrieved and the last entry is not found, no entries will be retrieved.
1{"status":404,"response":{"code":"not_found","message":"Entry with id 1001 not found","data":"1001"}}

Notes: The entry meta keys which may be used are listed in the Sorting section.
Parameters:

Paging – Controls the number of entries retrieved per page and allows paging to be implemented
Sorting – Allows entries to be sorted by a specific field and to be sorted ascending/descending.
Search – Allows entries to be filtered by search criteria and field filters.

Example:
The example below retrieves specific fields for a single entry:

PHP
123456789101112131415161718192021222324252627282930313233343536373839404142//set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'entries/1000/fields/id;form_id;date_created;is_starred;is_read;1.3;1.6;'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'GET', $route, $expires );$sig = calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wp/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; //retrieve data$response = wp_remote_request( urlencode( $url ), array( 'method' => 'GET' ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    //echo (wp_remote_retrieve_body( $response ) );    die( 'There was an error attempting to access the API.' );}  //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    $error = $body['response'];    die( "Could not retrieve entry. Code: {$error['code']}. Message: {$error['message']}. Data: {$error['data']}." );} //entry retrieved successfully$entry = $body['response']; $entry_id = $entry['id'];$data_created = $entry['date_created'];$field_1 = $entry['1']; //Data for field with ID = 1. function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;}
JavaScript
WARNING: This sample JavaScript is not secure and it』s not intended to be used on production sites. Never send your private key to the browser. Consider using WordPress cookie authentication instead.
12345678910111213141516171819202122232425262728293031323334353637
POST /forms/[Form ID]/entries
Creates/adds entries for the specified Form ID

URI: /gravityformsapi/forms/[Form ID]/entries
Capability: gravityforms_edit_entries
Input: A JSON string containing a collection of entries that will be added
Output: A localized message describing the result: 「Entries created successfully」 with the entry ids that were inserted
Potential Errors:
If the entry information passed over to the API is not an array, an invalid_entry_object error code is returned:
1{"status":error_code,"response":{"code":"invalid_entry_object","message":"The entry object must be an array"}}
If a form id is not provided for an entry, an empty_form_id error code is returned:
1{"status":400,"response":{"code":"empty_form_id","message":"The form id must be specified"}}
If an invalid form id is provided, an invalid_form_id error code is returned:
1{"status":400,"response":{"code":"invalid_form_id","message":"The form for this entry does not exist"}}
If there is a problem inserting the entry in the database, the following message is displayed, along with the applicable SQL error, if one exists:
1{"status":error code,"response":{"code":"insert_entry_properties_failed","message":"There was a problem while inserting the entry properties","data":"sql statement"}
If there is a problem inserting the value for a field which has inputs, the following message is displayed, along with the applicable SQL error, if one exists:
1{"status":error code,"response":{"code":"insert_input_value_failed","message":"There was a problem while inserting one of the input values for the entry","data":"sql statement"}
If there is a problem inserting the value for a field, the following message is displayed, along with the applicable SQL error, if one exists.
1{"status":error code,"response":{"code":"insert_field_values_failed","message":"There was a problem while inserting the field values","data":"sql statement"}

Notes: If values are not provided for the following entry fields, default values are used:

date_created – utc_timestamp()
is_starred – 0
is_read – 0
ip – $_SERVER
source_url – http://$_SERVER[『HTTP_HOST』] . $_SERVER[『REQUEST_URI』] (If $_SERVER[『HTTPS』] or force ssl is on, then https is used)
user_agent – API
currency – USD
status – active
created_by – current user id if logged in

Example:

PHP
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586//set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'forms/28/entries'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'POST', $route, $expires );$sig = calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wp/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; $entries = array(    array(        'date_created' => '2015-06-15 22:43:23',        'is_starred'   => 0,        'is_read'      => 1,        'ip'           => '::1',        'source_url'   => 'http://localhost/wp/?gf_page=preview&id=28',        'currency'     => 'USD',        'created_by'   => 1,        'user_agent'   => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0',        'status'       => 'active',        '1.3'          => 'Manually',        '1.6'          => 'Created Entry using Form route',        '2'            => 'Creating using REST API v1',        '3'            => 'Manually created using the POST route of the REST API v1',    ),    array(        'date_created' => '2015-06-15 22:43:23',        'is_starred'   => 0,        'is_read'      => 1,        'ip'           => '::1',        'source_url'   => 'http://localhost/wp/?gf_page=preview&id=28',        'currency'     => 'USD',        'created_by'   => 1,        'user_agent'   => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0',        'status'       => 'active',        '1.3'          => 'Manually',        '1.6'          => 'Created Entry 2 using Form route',        '2'            => 'This entry was created manually using the REST API v1.',        '3'            => 'Manually created',    ),); //json encode array$entry_json = json_encode( $entries ); //retrieve data$response = wp_remote_request( urlencode( $url ), array( 'method' => 'POST', 'body' => $entry_json ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    $error = $body['response'];         //entry update failed, get error information, error could just be a string    if ( is_array( $error )){        $error_code     = $error['code'];        $error_message  = $error['message'];        $error_data     = isset( $error['data'] ) ? $error['data'] : '';        $status     = "Code: {$error_code}. Message: {$error_message}. Data: {$error_data}.";    }    else{        $status = $error;    }    die( "Could not post entries. {$status}" );} $entry_ids = $body['response'];$entry_ids_created = 'The following entry ids were created:
';foreach ( $entry_ids as $entry_id ){       $entry_ids_created .= $entry_id . '
';} function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;}
JavaScript
WARNING: This sample JavaScript is not secure and it』s not intended to be used on production sites. Never send your private key to the browser. Consider using WordPress cookie authentication instead.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
PUT /entries/[Entry ID]
Updates the entry with the given ID

URI: /gravityformsapi/entries/[Entry ID]
Capability: gravityforms_edit_entries
Input: A JSON string with the entry. If an entry ID is provided in the entry object, it will NOT be used. The id provided in the request is used. Please see the Entry Object for more details regarding what may be included.
Output: A message describing the result: 「Entry updated successfully」
Potential Errors:
If the entry id provided cannot be found, a not_found error code is returned:
1{"status":404,"response":{"code":"not_found","message":"Entry with id 1000 not found","data":"1000"}}
If an invalid form id is provided when updating the entry, an invalid_form_id error code is returned:
1{"status":400,"response":{"code":"invalid_form_id","message":"The form for this entry does not exist"}}
If there is a problem updating the entry in the database, the following message is displayed, along with the applicable SQL error, if one exists.
1{"status":error code,"response":{"code":"update_entry_properties_failed","message":"There was a problem while updating the entry properties","data":"sql statement"}
If there is a problem updating the value for a field which has inputs, the following message is displayed, along with the applicable SQL error, if one exists.
1{"status":error code,"response":{"code":"update_input_value_failed","message":"There was a problem while updating one of the input values for the entry","data":"sql statement"}
If there is a problem updating the value for a field, the following message is displayed, along with the applicable SQL error, if one exists.
1{"status":error code,"response":{"code":"update_field_values_failed","message":"There was a problem while updating the field values","data":"sql statement"}

Notes: If values are not provided for the following entry fields, default values are used:

date_created – utc_timestamp()
is_starred – 0
is_read – 0
ip – $_SERVER
source_url – http://$_SERVER[『HTTP_HOST』] . $_SERVER[『REQUEST_URI』] (If $_SERVER[『HTTPS』] or force ssl is on, then https is used)
user_agent – API
currency – USD
status – active
created_by – current user id if logged in

Example:

PHP
The example below updates field id 3, read status, starred status for entry id 146. The existing entry object array is retrieved and the values in the array are modified. That array is then what is JSON-encoded and passed along for updating.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950//set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'entries/146'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'PUT', $route, $expires );$sig = calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wp/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; $entry = GFAPI::get_entry( 146 );$entry['3'] = 'Rapid Fire';$entry['is_read'] = 0;$entry['is_starred'] = 1; $entry_json = json_encode( $entry ); $response = wp_remote_request( urlencode( $url ), array( 'method' => 'PUT', 'body' => $entry_json ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed        die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    $error = $body['response'];         //entry update failed, get error information    $error_code     = $error['code'];    $error_message  = $error['message'];    $error_data     = isset( $error['data'] ) ? $error['data'] : '';    $status     = "Code: {$error_code}. Message: {$error_message}. Data: {$error_data}.";}else{    //entry updated successfully    $status  = $status_code;} die( "Entry update status: {$status}" ); function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;}
JavaScript
WARNING: This sample JavaScript is not secure and it』s not intended to be used on production sites. Never send your private key to the browser. Consider using WordPress cookie authentication instead.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
DELETE /entries/[Entry ID]
Deletes the entry or entries with the specified ID or IDs. The deletion process completely removes the entry; it will NOT be available in the Trash.

URI: /gravityformsapi/entries/[Entry ID]
12345//delete a single entryhttp://[your_domain]/gravityformsapi/entries/1 //delete multiple entrieshttp://[your_domain]/gravityformsapi/entries/1;3;6

Capability: gravityforms_delete_entries
Output: A localized message describing the result: 「Entries deleted successfully」
Potential Errors:
If an entry being deleted cannot be found, and invalid_entry_id code is returned.
1{"status":400,"response":{"code":"invalid_entry_id","message":"Invalid entry id: 164","data":"164"}}

Notes: If an error is encountered while deleting one of the entries in a list of multiple entries, the error information is returned, and no further entries are deleted.
Example:
The example below deletes the entries with ids 164, 165, 166.

PHP
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849//set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'entries/164;165;166'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'DELETE', $route, $expires );$sig = calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wp/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; //retrieve data$response = wp_remote_request( urlencode( $url ), array( 'method' => 'DELETE' ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    $error = $body['response'];         //entry update failed, get error information, error could just be a string    if ( is_array( $error )){        $error_code     = $error['code'];        $error_message  = $error['message'];        $error_data     = isset( $error['data'] ) ? $error['data'] : '';        $status     = "Code: {$error_code}. Message: {$error_message}. Data: {$error_data}.";    }    else{        $status = $error;    }}else{    //entries deleted successfully    $status  = $status_code;} die( "Entry deletion status: {$status}" ); function calculate_signature( $string, $private_key ) {    $hash = hash_hmac( 'sha1', $string, $private_key, true );    $sig = rawurlencode( base64_encode( $hash ) );    return $sig;}
JavaScript
WARNING: This sample JavaScript is not secure and it』s not intended to be used on production sites. Never send your private key to the browser. Consider using WordPress cookie authentication instead.
123456789101112131415161718192021222324252627282930313233
If the deletion is successful, the response will look like the following:
1{"status":200,"response":"Entries deleted successfully: 3"}
Results
GET /forms/[Form ID]/results
Returns the aggregate results (entry counts) for each of the fields in the given form.
If the results take longer than approximately 20 seconds to complete, then the calculation process will stop and the incomplete results will be returned with a status code of 202 (accepted).
The calculation will continue in the background using a recursive wp_cron task with breaks of ten seconds until it finishes. When the calculation is complete, the results will be returned with a status code of 200 (OK).
If the background task for a request stops for more than 3 minutes (e.g. system restart, script timeout or memory issues) it will be rescheduled the next time the server is polled for the same request.
After an entry has been created the status of the results will change to 「expired」 and the new calculation of the results will begin again in the background.
When the fields have been edited using the form editor all cached results for that form will be deleted.
Editing form settings will not affect the cached results.

URI: /gravityformsapi/forms/[Form ID]/results
Capability: gravityforms_view_entries
Output: A JSON string containing the results data plus the following where appropriate:

status = 「incomplete」, 「complete」 or 「expired」
timestamp = [UTC UNIX timestamp for the calculation]
progress = [percentage of results calculated so far]
offset = [number of entries processed so far]

Potential Errors:

If the form id specified cannot be found, a 「Not found」 message is returned.
1{"status":404,"response":"Not found"}

Example:
The example below retrieves the results for form id 3 which has two text fields. The count of how many times each field has been filled out is returned.

PHP
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748//set API keys$api_key = 'your_api_key';$private_key = 'your_private_key'; //set route$route = 'forms/3/results'; //creating request URL$expires = strtotime( '+60 mins' );$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'GET', $route, $expires );$sig = calculate_signature( $string_to_sign, $private_key );$url = 'http://localhost/wp/gravityformsapi/' . $route . '?api_key=' . $api_key . '&signature=' . $sig . '&expires=' . $expires; //retrieve data$response = wp_remote_request( urlencode( $url ), array( 'method' => 'GET' ) );if ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){    //http request failed    die( 'There was an error attempting to access the API.' );} //result is in the response "body" and is json encoded.$body = json_decode( wp_remote_retrieve_body( $response ), true ); if( $body['status'] > 202 ){    $error = $body['response'];     if ( is_array( $error ) ) {        //get error information        $error_code     = $error['code'];        $error_message  = $error['message'];        $error_data     = isset( $error['data'] ) ? $error['data'] : '';        $status         = "Code: {$error_code}. Message: {$error_message}. Data: {$error_data}.";        die( "Could not retrieve results. {$status}" );    }    else{        die( $error );    }}else{    $response = $body['response'];    $entry_count = $response['entry_count'];    $field_data = $response['field_data'];    $retrieval_status = $response['status'];    $timestamp = $response['timestamp'];    foreach ( $field_data as $id=>$data ){        echo 'Field: ' . $id . ' Count: ' . $data;    }}
JavaScript
WARNING: This sample JavaScript is not secure and it』s not intended to be used on production sites. Never send your private key to the browser. Consider using WordPress cookie authentication instead.
1234567891011121314151617181920212223242526272829303132333435363738
Sample JSON output from the code above:
1{"status":200,"response":{"entry_count":"3","field_data":{"1":4,"2":2},"status":"complete","timestamp":1448490482}}
Tools
Sample REST API v1 Client
A sample add-on using the REST API v1 is available on GitHub:
https://github.com/rocketgenius/webapiclient
PHP Wrapper
The PHP wrapper itself can be found inside the includes folder of the sample REST API v1 client add-on:
https://github.com/rocketgenius/webapiclient/blob/master/includes/class-gf-web-api-wrapper.php
Please take a look at both the inline documentation and the sample REST API v1 client add-on for examples of how to use it.
URL generator & tester
On the REST API v1 settings tab you』ll find a link to the developer tools. The tools include a URL generator and a URL tester. These will help you generate the correct signatures so you can check you』re generating the correct URLs.
Other resources
Tutorial on the Gravity Forms API
Go package for Gravity Forms REST API v1 (3rd Party Resource)
Note that this is not maintained by or affiliated with Gravity Forms or Rocketgenius. Not officially supported. Use at your own risk.

Using the Gravity Forms 「gform_validation」 Hook

Using the Gravity Forms 「gform_validation」 Hook

The PremiseGetting StartedThe Validation ResultGetting the Current PageLooping Through the FieldsFind Field by CSS ClassGetting the Field Page NumberIs the Field Hidden?Skip Field If…Retrieve & Validate the Submitted ValueCheck If the Field Value is ValidUh, oh! It Failed Validation!Assign the Modified Form Back to the Validation ResultReturn the Validation Result

The Premise
Let』s imagine that we』re building some sort of car related website. On this fictional website we have a Gravity Form that allows you to register cars you own and part of that registration is a field for the VIN number of the vehicle. So how do we ensure that the user is entering a valid VIN number? Yup. The gform_validation hook.
Getting Started
The first step is to tie our custom validation function to the gform_validation filter.
// 1 - Tie our validation function to the 'gform_validation' hook
add_filter( 'gform_validation_9', 'validate_vin' );

This line is just us telling Gravity Forms that whenever it validates the form submission, we』d like it to also run our custom validate_vin function as well. In addition, since this is a filter and not an action (read more about the difference here) we』re also telling Gravity Forms that we』d like to modify the validation result and continuing processing the rest of the validation with those modifications preserved.

Note: You』ll notice we』ve appended a 『9』 to the end of the 『gform_validation』 filter name. This means that we only want to trigger our custom validation function from form ID 9. No sense in running an extra function on every form submission if we only need it on one specific form. Just replace the 9 with the ID of the form you』d like to target.*

The Validation Result
When Gravity Forms calls our custom function it will pass an array containing two important items for form validation.

$validation_result[『is_valid』] This property will be either true or false and indicates whether or not the form has failed any of Gravity Forms』 default validation checks. You』ll see this again on step 13.
$validation_result[『form』] This property contains the Form Object which itself contains an array of all the fields created for this form.

// 2 - Get the form object from the validation result
$form = $validation_result['form'];

With that said, all we』re doing here is setting the form object from the validation result to a local variable that will be easier to read and use.
Getting the Current Page
// 3 - Get the current page being validated
$current_page = rgpost( 'gform_source_page_number_' . $form['id'] ) ? rgpost( 'gform_source_page_number_' . $form['id'] ) : 1;

If you aren』t using multi-page forms, this step doesn』t apply to you but it wouldn』t hurt to know how it works.
When you submit a page on a multi-page form, Gravity Forms will populate some additional info in the $_POST global (read more here if you』re unfamiliar with the $_POST). One of those helpful bits of information is the source page number (aka the current page you are validating). We』ll use the rgpost function to retrieve the source page number from the $_POST.
So why is this important? Because if the field we want to validate is on page 2 of our form and the user just submitted page 1, that field will be blank and will fail the validation for the entire form preventing the user form progressing to the next page.
Looping Through the Fields
// 4 - Loop through the form fields
foreach( $form['fields'] as &$field ) {

As mentioned earlier, the Form Object contains an array of fields created for that form. Using a loop we can go through each field one by one and run a series of checks and conditions to determine if it is a field that should be validated for a VIN number.

Note: You』ll see continue in a couple places in the code within the loop. This means that we want to skip the rest of the loop for whatever field we are on and move on to the next field.*

Find Field by CSS Class
// 5 - If the field does not have our designated CSS class, skip it
if ( strpos( $field->cssClass, 'validate-vin' ) === false ) {
continue;
}

In this example, we』re looking for a specific string based on the field』s CSS class property. We could change this to check by field ID or any other field property, but I』ve found that the CSS class is a user friendly way of quickly adding custom validation functionality to most fields. Basing this check on field ID would have the drawback of requiring a code change if you ever needed to remove the field and apply the custom validation to a different field. With the CSS class technique, you can simply add the designated CSS class to the new field from the Gravity Form editor. The designated class we』re using here is validate-vin.
If validate-vin CSS class is not present on the current field, we will skip it and move on to the next field. If the field does have the validate-vin class, we know that this is a field we』ve marked for VIN validation and we』ll proceed to the next step.
Getting the Field Page Number
// 6 - Get the field's page number
$field_page = $field->pageNumber;

This step is also multi-page form specific.
When using the multi-page functionality, each field has a pageNumber property which stores the page number on which that field is displayed. We』ll be using this variable on step 8.
Is the Field Hidden?
// 7 - Check if the field is hidden by GF conditional logic
$is_hidden = RGFormsModel::is_field_hidden( $form, $field, array() );

It』s important to know whether or not the field we are validating is hidden by Gravity Form』s conditional logic. Hidden fields should not be validated because they are not part of the form submission.
Gravity Forms provides a handy public function that you can use to determine if a field is hidden: RGFormsModel::is_field_hidden(). To use this function all you need is a Form Object and a field to check.
Skip Field If…
// 8 - If the field is not on the current page OR if the field is hidden, skip it
if ( $field_page != $current_page || $is_hidden ) {
continue;
}

The previous two steps we gathered some information about the current field. Now we』re putting that information to use. If the field is not on the current page OR if the field is hidden, we don』t want to run our VIN validation function on it. Instead, we』ll continue on to the next field in the loop.
Retrieve & Validate the Submitted Value
// 9 - Get the submitted value from the $_POST
$field_value = rgpost( "input_{$field['id']}" );

// 10 - Make a call to your validation function to validate the value
$is_valid = is_vin( $field_value );

So… if the field gets to this point we know that it:

has the designated validation CSS class
is on the current page being validated
and is not hidden

We』re now ready to retrieve and validate the submitted value for this field. Let』s retrieve the value of of the field using the rgpost function (which is a clean way of retrieving values from the $_POST). The string we』re passing to this function would look something like 「input_48」 if we weren』t dynamically populating the field ID using the current field』s ID property.

Note: This method for retrieving the field value will work for most fields. Known exceptions are checkboxes and fields with multiple inputs. We will cover those later as an addition to this walk-through.*

Next, we create an $is_valid variable and assign it the result of our VIN validation function. We pass is_vin() our field value and it returns a true/false value indicating whether the submitted value is a valid VIN number.
Check If the Field Value is Valid
// 11 - If the field is valid we don't need to do anything, skip it
if ( $is_valid ) {
continue;
}

If the submitted value is valid, then we don』t need to update any of the validation properties for this field. It』s good to go!
If you are only validating one field for the VIN number (which is likely the case) you could technically stop here and return the unmodified validation result; however, for the sake of explanation and making this code sample as useful as possible, let』s assume that you』re validating multiple fields. That means we』d skip the rest of the code for this field and start back with the next field at the very top of the loop.
Uh, oh! It Failed Validation!
Ok, so we made it all the back to the is_vin() validation function on the next VIN field… but this one failed validation. What do we do now?
// 12 - The field field validation, so first we'll need to fail the validation for the entire form
$validation_result['is_valid'] = false;

// 13 - Next we'll mark the specific field that failed and add a custom validation message
$field->failed_validation = true;
$field->validation_message = 'The VIN number you have entered is not valid.';

Well, first since we know that there is a validation error on the form, let』s make sure we mark the $validation_result is_valid property as false. When we return our modified validation result, this property is how Gravity Forms knows to look for validation errors on the individual fields.
Next, we』re going to mark the $field failed_validation property as true, because, well… it did! In addition, we』ll want to provide a custom validation message so the user filling out the form will know what the problem is.
Assign the Modified Form Back to the Validation Result
// 14 - Assign our modified $form object back to the validation result
$validation_result['form'] = $form;

This step is super important! We』ve updated a field of this form with validation failure details but if we don』t assign the Form Object back to the form property of the $validation_result, Gravity Forms won』t know which field had the error.
Return the Validation Result
// 15 - Return the validation result
return $validation_result;

And finally, we return the modified (or perhaps unmodified if no validation errors were found) $validation_result back to Gravity Forms. Assuming that a field did fail validation, Gravity Forms will now prevent the form from submitting successfully and mark each field that has a validation error with its corresponding validation message.

Video Tutorials

Video Tutorials

Three Quick Start VideosLonger Video Tutorials

Three Quick Start Videos
Click this link to see our sequence of three very short videos to quickly get you through the basics of downloading, installing, creating a form, embedding a form, and even installing and connecting a sample add-on. Don』t forget the previous/next button at the bottom of each page to cycle through them all!
After those quick intros, you can dive deeper with the Getting Started documentation category on this very site.
Longer Video Tutorials
Head over to this page on our main site for a selection of longer, topic-specific videos. They cover areas like enabling notifications and confirmations, using conditional logic, creating a survey and even collecting credit card payments with Stripe.

Using the reCAPTCHA Add-On

Using the reCAPTCHA Add-On

IntroductionPre-RequisitesSetupBehaviorReviewing Spam EntriesNotesMore info

Introduction

The official Gravity Forms reCAPTCHA Add-On brings Google』s reCAPTCHA v3 technology as an addition to your anti-spam toolbox.

V3 was introduced to try and capitalize on the evolving technology of spam and bot detection that Google had implemented, and to try and make the reCAPTCHA experience as frictionless as possible by not interrupting the user. As stated by Google, reCAPTCHA v3:

…return(s) a score to tell you how suspicious an interaction is and eliminating the need to interrupt users with challenges at all. reCAPTCHA v3 runs adaptive risk analysis in the background to alert you of suspicious traffic while letting your human users enjoy a frictionless experience on your site. Google Blog post, October 2018

Pre-Requisites

This add-on requires Gravity Forms 2.5 or higher. You will need reCAPTCHA v3 keys generated by Google. reCAPTCHA technology requires Javascript to be enabled in the user』s browser. 

Setup

Instructions for setup are covered in this article.

The reCAPTCHA v2 settings previously provided in Gravity Forms core are consolidated into this settings area as well.

Behavior

With reCAPTCHA v3 correctly enabled on the site with valid keys, various actions are noted and sent to Google for them to try and identify possible spam or bot activity. This processing is done on Google』s servers, and the result is the assignment of a score to the activity. reCAPTCHA v3 returns a score, where 1.0 is very likely a good interaction, 0.0 is very likely a bot.

Note that all well-formed entries are accepted when submitted, and the Google reCAPTCHA score that is generated with that interaction is stored with the entry. Gravity Forms will compare that score to the threshold established in your settings, and if the entry is less than or equal to that threshold, the entry will be sent to spam.

When using reCAPTCHA v3, you no longer need to add a reCAPTCHA field to your form (that field applies to v2 implementations only). The v3 integration ensures that it is automatically enabled on all forms unless it is disabled in the form settings of an individual form.

Reviewing Spam Entries

You can review entries that were marked as spam by following the directions provided in this article.

Notes

Does not affect older reCAPTCHA functionality as previously provided in Gravity Forms. Both can exist on the same page if necessary.Works with multi-page forms. reCAPTCHA does not process submissions submitted from the form preview.Use of this Google service requires the sending of user behavior information from all your site pages to Google for evaluation. You should be familiar with the implications here, and review applicable privacy policy and terms and conditions. Additionally, you are required to display those policies to your users, which is handled with the reCAPTCHA badge.

More info

Google』s developer documentationGoogle』s reCAPTCHA FAQ

Using the Mollie Add-on

Using the Mollie Add-on

IntroductionPrerequisitesSetup MollieSetup Your FormSetting up a Mollie FeedViewing Sales ResultsImportant NotesMollie Add-On HooksAdd-On Framework Hooks

Introduction
The official Gravity Forms Mollie Add-On allows you to quickly and easily capture one-time credit card payments with WordPress and your Mollie account.
Prerequisites

You will of course need Gravity Forms and the official Gravity Forms Mollie Add-On installed and activated.
SSL Certificate Installed and Configured
Publicly Accessible Website (for installation and testing)
A Mollie account

Because of the secure nature of capturing credit card information, you will be required to install an SSL certificate on your web site if you have not already done so. You will also need to configure your WordPress site to work properly with SSL.
Contact your web host if you need assistance purchasing and configuring an SSL certificate.
If you need assistance configuring your WordPress site to work with SSL, we recommend the WordPress HTTPS (SSL) Plugin which you can find here: http://wordpress.org/extend/plugins/wordpress-https/
Setup Mollie
Learn how to setup the Mollie Add-on in our Setting Up the Mollie Add-on article.
Setup Your Form
Refer to the Setting up a Mollie Compatible Form article for detailed instructions on how to setup your form to be compatible with the Mollie Add-on.
Setting up a Mollie Feed
Now that you have configured the Mollie Add-on to work with your Mollie account, and you have a form configured, it』s time to bring it all together by configuring the form to send it』s submissions to Mollie. Just like all of our Gravity Forms Add-ons, this is done by creating a feed.
Review our Creating a Feed for the Mollie Add-on article for step-by-step instructions.
Note that a pre-configured feed will be created in the Form Settings > Mollie area when a form containing a Mollie Field is saved, and a feed does not already exist.

Viewing Sales Results
After creating a feed and making your first sale, you can view the results on the Sales Results page.  Review Viewing Sales Results article for more information.

Important Notes

Only one-time credit card payments (Products and Services transaction type) are supported with the Mollie Add-on. Recurring payments (Subscriptions) are not supported in our Mollie Add-On at this time. Let us know how important creating subscriptions is to you on our roadmap.
The currency setting for your Mollie Account must match your Gravity Forms Currency Setting. Whichever Currency setting you have configured in Gravity Forms will define the payment methods available in the Mollie Field.
You cannot refund the same amount twice from Mollie. This is a known issues with the Mollie Dashboard: the refund modal will remain with a spinner and no errors message displayed. This isn』t really a Gravity Forms Add-on Issue, but an issue with refunds from within Mollie and the Refund Webhook communication.
Credit Card payments without 3D Secure do not receive a refund webhook. This means the payment status of entries won』t be updated if the payment is refunded from Mollie.

Mollie Add-On Hooks
The Mollie Add-On provides hooks that can be used to modify the default functionality or extend it. For more information, review the Mollie Add-On Hooks.
Add-On Framework Hooks
Because the Mollie Add-On is built using the Add-On Framework it also inherits any hooks available in the framework methods it uses such as:
gform_{$SHORT_SLUG}_field_value for changing a field value before it is passed to Mollie.