Viewing Poll Results

Viewing Poll Results

Where can I see the Poll Results?Poll Results DisplayNoteResults FilterResetting Poll Results

Where can I see the Poll Results?

As a site administrator, you can view results from a poll by navigating to the Form with the poll in it, and clicking the Poll Results link at the top of the form editor. Poll results can be viewed either through the form builder or the Entries page.

Poll Results Display

Within this page, you will see the current results for your particular poll. In the right sidebar, you also have the ability to set filter conditions to further slice your poll data.

Poll results can be displayed to visitors of your site via the Poll Shortcode

Note

If you delete a poll field from your form the poll data will be irreversibly deleted as well.

Results Filter

The filter section displayed in the right hand sidebar allows you to limit which entries are included in your results display.

Include results if allows you filter the entries that make up your results display, based on criteria such as the content of a particular form field, or other submission metadata.

Start date and End date limit your results display to those submission made within a certain date range.

Resetting Poll Results

You can learn about resetting results by reading this article.

Viewing Quiz Results

Viewing Quiz Results

Where can I see the Quiz Results?Quiz Results DisplayResults FilterQuiz ScoringResetting Results

Where can I see the Quiz Results?

As a site administrator, you can view results from a quiz by navigating to the Form with the quiz in it, and clicking the Quiz Results link at the top of the form editor.

If you have multiple Add-Ons installed that support results, you will need to hover over the 「Results」 item and then select 「Quiz Results」.

Quiz Results Display

The quiz results are divided into a few sections within a dashboard style layout. What data you see is also dependent on which type of Quiz Grading you have enabled.

SectionDescriptionTotal EntriesQuantity of all the entries you have received for this quiz.Average ScoreAverage score as calculated across all entries received. Average PercentageAverage percentage score as calculated across all entries received.Score FrequenciesDisplays a frequency bar chart showing the spread of each quiz score. Grade FrequencyIf using letter grades, will show the frequency of each letter grade across all entries received. Individual BreakdownsThe bottom area shows each quiz field on your form, and the frequency of each answer provided.

Results Filter

The filter section displayed in the right hand sidebar allows you to limit which entries are included in your results display.

Include results if allows you filter the entries that make up your results based on other factors, such as a particular form field, or other submission metadata. For example, you could filter just those of a certain Quiz Percentage or Grade.

Start date and End date limit your results display to those submission made within a certain date range.

Quiz Scoring

Under normal scoring, a correct answer counts as 1, and an incorrect answer as 0. As such, the percentage will be the percentage of correct answers.

When using weighted scoring, you can specify different scores for each possible answer. For example, you could make one question worth 3 points for the right answer, or even make wrong answers be a negative score. This has a significant effect on scoring, especially when adding checkboxes (multiple choice) into the quiz.

Refer to our guide to Quiz Scoring for the complete rules and some detailed examples.

Caveat: Quiz results are calculated dynamically on request, As such, if you change the correct answer (or the weighted score) on a question, all past Quiz Results will be re-calculated when viewed again, which may vary from what was previously presented in the results dashboard, or to the user at the time they completed the quiz.

Resetting Results

You can learn about resetting results by reading this article.

Viewing Sales Results

Viewing Sales Results

Where can I see the Sales Results?Sales Results DisplayResults Filter

Where can I see the Sales Results?

As a site administrator, you can view results from a payment add-on like Stripe or PayPal by navigating to the Form and clicking the Sales link at the top of the form editor.

If you have multiple Add-Ons installed that support results, you will need to hover over the 「Results」 item and then select 「Sales」 in the submenu.

Sales Results Display

The sales results are divided into a few sections within a dashboard style layout. 

SectionDescriptionTodayDisplays the value of orders and subscriptions made today.YesterdayDisplays the value of orders and subscriptions made yesterday.Last 30 DaysDisplays the value of orders and subscriptions made in the last 30 days.TotalDisplays the value of orders and subscriptions made in total.Results GraphDisplays sales results in a visual format.Results NumbersDisplays sales results in a number format.

Results Filter

The filter section displayed in the right hand sidebar allows you to limit which results are included in your display.

View selects how you would like the data to be displayed: Daily, Weekly, or Monthly.

Payment Method allows you to view only certain payment methods like Visa or Mastercard.

Start date and End date limit your results display to those submission made within a certain date range.

Viewing Survey Results

Viewing Survey Results

Where To Find ThemResults DisplayResults FilterExportingResetting Survey Results

Where To Find Them

Your survey results can be accessed from within the Entries page or from within the Form Editor.

On either of these pages, click on Survey Results in the top menu bar.

If you are using multiple add-ons that generate results, you may need to hover over Results and click on Survey Results.

Results Display

The main page of the results display will show the quantity of responses received for each answer of every question included.

Note that these results are calculated dynamically, so will be affected by any changes made to entries after submission.

Results Filter

The filter section displayed in the right hand sidebar allows you to limit which entries are included in your results display.

Include results if allows you filter the entries that make up your results display, based on criteria such as the content of a particular form field, or other submission metadata.

Start date and End date limit your results display to those submission made within a certain date range.

Exporting

You cannot export the summary results, but you can export the entries that constitute them if you wish to work on your own dataset manipulations. See this article for more information on exporting entries.

Resetting Survey Results

You can learn about resetting results by reading this article.

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'                              )          );

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.

Troubleshooting the Zapier Add-On

Troubleshooting the Zapier Add-On

Getting StartedAssumptionsEnabling LoggingTools > Site Health TestsAuthorization header is missingSSL ErrorsZapier Settings aren』t available in Gravity FormsUnable to view Forms at Zapier or unable to create Zaps or FeedsOther Issues that can impact Zapier Communication

Getting Started

We』ve put together this troubleshooting guide to help if you run into issues connecting Zapier to your Gravity Forms with the Zapier Add-On.

Assumptions

If you』ve run into an issue communicating with Zapier, it will more than likely happen when first authenticating the REST API connection at Zapier. To help rule out the most common problems, we do make the following assumptions regarding your Website and WordPress installation:

WordPress, Gravity Forms and the Zapier Add-On are all upgraded to the most currently released versionsSSL Certificate Installed and Configured on your WordPress website and operating properlyWebsite accessible to the internet

The authentication from Zapier to Gravity Forms uses REST API with Basic Authentication so your website must be accessible for that connection to occur. If you are running your WordPress website in any of the following configurations:

Behind a Firewall or regionally blocked accessCloudFlare or Caching or another methodology that involves some form of redirection or off-loading of contentSecurity Login plugins or redirected login to a Single Sign-On authorityWordFence or other restriction of access plugins that directly block REST API.htpasswd or other password protection plugins that restrict access to your site

You will need to either Whitelist the REST API endpoints for Gravity Forms and/or possibly add additional rules to those plugins or applications to allow Zapier to connect to your website in an unrestricted way.

Enabling Logging

You can determine what is happening with REST API by Enabling Logging for Gravity Forms API and checking the log files while you』re attempting to connect at Zapier. You can get good details on interpreting the log in our Troubleshooting REST API article.

The log will contain entries for every time that Zapier reaches out to your website attempting to authenticate, when creating or editing a zap, and when enabling and disabling a Zap within your Zapier Account dashboard.

If you reach out to Gravity Forms Support for help, we will require logging to be enabled for both Gravity Forms API and the Zapier Add-On.

Tools > Site Health Tests

With the most recent versions of WordPress, you can determine if your website has issues right in your WordPress Admin dashboard. This is the first place you should look if you』re having issues connecting from Zapier.

Go to Tools > Site Health in your WordPress Dashboard. A series of tests will be run against your installation to determine if your website is operating properly.

The tests we focus on are for the Authorization header:

Successful Authorization header test from Tools > Site Health

REST API:

Successful REST API test from Tools > Site Health

and SSL (HTTPS):

Successful HTTPS/SSL test from Tools > Site Health

If any of the above tests are failing or have errors, you will need to reach out to your Server Host for assistance in correcting the issues.

The following resources may be helpful to provide to your Server Host for troubleshooting:

WordPress .htaccess rewrite rules (will usually help with Authorization issues)WordPress REST API Connection FAQ

Authorization header is missing

If you』re receiving an error like the following in your Tools > Site Health under Security:

Authorization Header Test with an error.

This will mean that Basic Authentication will not work properly. If Basic Authentication is failing, you will need to reach out to your Server Host to resolve.

SSL Errors

If you』re seeing errors in the SSL sections like the following:

SSL Errors in Tools > Site Health

This will indicate that either your SSL isn』t properly configured, or is missing some necessary configuration steps. You will need to reach out to your Server Host to correct as SSL is required for Zapier to make a connection to your site. WordPress Site Health will attempt to provide a recommended solution for you, but there are some good resources below:

WordPress HTTPS and SSL Support FAQ

Zapier Settings aren』t available in Gravity Forms

If you have a membership or roles & capabilities plugin like Members installed, you will need to provide access to the Zapier capabilities in order to see the Settings under Forms > Settings > Zapier. Check our Roles & Capabilities documentation as that will show you which capabilities must be active to see those settings.

Unable to view Forms at Zapier or unable to create Zaps or Feeds

This usually indicates that you』re using an account that doesn』t have the correct access to the Gravity Forms settings. Verify the following:

Using an account in the REST API settings that doesn』t have the gravityforms_edit_forms capability.Only using 『READ』 access in your Forms > Settings > REST API account

Both of these are common issues and easy to correct. Switch your accounts to Admin Accounts in the Forms > Settings > REST API keys and make sure you』re using 『read/write』 access as defined in our REST API documentation.

Other Issues that can impact Zapier Communication

Attempting the connection on a website that isn』t running SSL or isn』t public to the internet. This can include websites hidden behind .htpasswd or other login methods.Having Authentication, REST API or SSL errors in your Tools > Site Health report (see above).Incorrect settings in your .htaccess files that are causing bad redirections or adding trailing backslashes to your REST API requests.Having some service in-between your website and REST API on your WordPress installation that is changing the content of the REST API requests. These issues usually will let Zapier see your site and seem to be working but Feeds won』t be created or you won』t be able to create Zaps.

We can help you troubleshoot to determine if any of the above issues are the problem you』re experiencing. Open a support ticket and we』ll help you troubleshoot the issue.

Twilio Change Log

Twilio Change Log

2.8 | 2020-09-152.7 | 2020-05-062.6 | 2019-08-072.5 | 2018-04-122.4 | 2017-08-022.3 | 2017-04-282.2 | 2016-08-312.1 | 2015-04-202.0 | 2014-12-111.1 | 2014-03-111.0 | 2011-11-010.2 | 2011-03-31

2.8 | 2020-09-15

Added support for Gravity Forms 2.5.
Adding logging statements for URL shortening during feed processing.
Updated the Bitly URL shortening service to the latest version to prevent intermittent failures while shortening URLs.

2.7 | 2020-05-06

Added translations for Hebrew, Hindi, Japanese, and Turkish.
Added support for feed duplication.
Fixed an issue with the From and Send To dropdowns in the feed settings not having default choices.

2.6 | 2019-08-07

Added security enhancements.
Fixed an issue with the shortened URL where long URLs with more than one parameter get truncated.
Fixed an issue where merge tags are escaped which breaks URLs with parameters.
Fixed issue where long messages (longer than 1600 characters) are not successfully sent.
Fixed an issue where messages with merge tags can't be sent.
Fixed an issue where only the first URL in the message can be shortened.

2.5 | 2018-04-12

Added security enhancements.
Added GPL to plugin header.
Updated Plugin URI and Author URI to use https.
Updated Twilio PHP SDK.
Fixed warning regarding the number of characters allowed for a message to display 1600 instead of 160.
Fixed Twilio PHP SDK not being included with final build.

2.4 | 2017-08-02

Added gform_twilio_message filter to modify the SMS message arguments before it is sent.
Added support for using merge tags in the To Number feed setting.
Added support for using test Twilio credentials.
Fixed a PHP warning for the From setting on the edit feed page if the API request for the numbers returned an error.
Fixed URLs not shortening in message if multiple merge tags are used.
Updated Twilio PHP SDK.
Updated URL shortened to use latest Bitly API.

2.3 | 2017-04-28

Added security enhancements.
Added translations.

2.2 | 2016-08-31

Added conditional logic support to the feed settings.
Updated to use the newer /Messages endpoint instead of /SMS/Messages.
Updated feed From Number setting) to use the select_custom field type allowing use of Alphanumeric sender IDs (Not supported by all countries.)
Updated minimum Gravity Forms version to 1.9.11.
Fixed an issue with the upgrade routine which caused it run even if a pre-framework version hadn't been installed.

2.1 | 2015-04-20

Updated the gform_twilio_set_to_phone_number filter to include $feed_id as the third parameter.
Updated logging.
Fixed a low severity security vulnerability in the admin area which could be exploited by authenticated users with form administration permissions.
Fixed an issue with URLs from processed merge tags not being shortened.
Fixed an issue with merge tag replacement in the message.
Fixed issue when shorten urls is checked and urls with spaces cause the Bitly url to be incomplete.
Fixed issue where a validated Twilio number was required even for non-trial Twilio accounts.
Fixed issue where a Bitly key was required in order to create a feed. Now feeds can be created without a Bitly key, but the "shorten URL" option requires it.

2.0 | 2014-12-11

Added integration with Add-On Framework.
Added text domain/path to header.
Updated POT file.
Updated required version of Gravity Forms to 1.8.17.
Updated code to new standards.

1.1 | 2014-03-11

Added new filter "gform_twilio_set_to_phone_number" to modify the TO phone number set in the admin.
add_filter("gform_twilio_set_to_phone_number", "change_to_number", 10, 2);
function change_to_number($to, $entry){
//grab phone number out of field 2, sample format "+17571234567"
$phone = !rgblank($entry["2"]) ? $entry["2"] : $to;
return $phone;
}
Added logging.
Updated to not send entries marked as spam.
Updated the URL to Bitly's API to use api.bit.ly instead of api.j.mp so the default short domain in the user's Bitly setting is used.
Fixed issue where RG_CURRENT_PAGE constant was not available when GF is deactivated.
Fixed issue on feed page that displayed only the first Twilio incoming phone number.
Fixed notices.
Fixed issue with merge tags with new lines on feed page.
Cleaned up extra parse_request add_hook with function that didn't exist.

1.0 | 2011-11-01

Added URL shortening support.
Changed Bitly short URL to http://j.mp.
Removing formatting characters from TO number when sending request to Twilio.

0.2 | 2011-03-31

Added feedback on settings page.
Added integration with PayPal so that SMS messages can be sent only when payment is received.
Added helper text and tooltips.

Twilio Feed Meta

Twilio Feed Meta

IntroductionUsageProperties

Introduction
The Feed Object meta for the Twilio add-on is an associative array containing the properties which determine how the add-on should process the form submission.
$feed['meta'] = array(
'feedName' => 'Your Feed Name',
'feed_condition_conditional_logic' => true,
'feed_condition_conditional_logic_object' => array(
'conditionalLogic' => array(),
),
);

Usage
We recommend accessing the $feed meta using the rgar() or rgars() functions, e.g.:
$conditional_logic_enabled = rgars( $feed, 'meta/feed_condition_conditional_logic' );

Properties

feedName string
The feed name which appears on the add-ons feeds tab.

fromNumber string
Phone number that the message will be sent FROM.

toNumber string
Phone number that the message will be sent TO.

smsMessage string
The SMS message that will be sent. Can contain merge tags.

shortenURL boolean
Should Bitly automatically shorten all URLs? Default is false.

feed_condition_conditional_logic boolean
Is the feed condition (conditional logic) setting enabled. Default is false.

feed_condition_conditional_logic_object array
An associative array containing the conditional logic rules. See the Conditional Logic Object for more details.

Error 『Unexpected T_STRING』 when installing Gravity Forms

Error 『Unexpected T_STRING』 when installing Gravity Forms

IssueProbable CauseRemedyNotes

Issue
When trying to install the current official Gravity Forms plug-in, an error is encountered with a message similar to the following:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in https://s22280.pcdn.co/.../../../wp-content/plugins/gravityforms/gravityforms.php on line..

Probable Cause
This error typically occurs because of a PHP version conflict, likely due to your server running an older version of PHP.
Remedy
Update your PHP version (or check with your web host).
Notes
Review the Gravity Forms System Requirements for what we recommend to get the optimal experience when running Gravity Forms.
Although Gravity Forms can operate with some older versions, there are major disadvantages in doing so:

sub-optimal performance
you may exclude yourself from receiving support
testing may not have been done on lesser unsupported versions
you are exposing yourself to security vulnerabilities

You should update to a more recent version.
Review this php.net notice to see the PHP versions that are officially supported by the vendor, including their 「end of active development」 and 「end of life」 dates.