What is this Charge on my Credit Card?

What is this Charge on my Credit Card?

I have a charge on my statement for Gravity Forms, can you explain what this is for?How Do I See My License?How Can I Get A Refund?How Can I Get More Info?

I have a charge on my statement for Gravity Forms, can you explain what this is for?
Gravity Forms is the pre-eminent WordPress plug-in to enable web professionals and website administrators to add simple or complex forms to their WordPress websites, as well as to integrate submissions from those forms to a host of external services. This helpful article explains what Gravity Forms is in a little more detail.

​If you have been billed for Gravity Forms, then you have purchased or renewed one of our licenses. Our licenses renew annually, and you can see our license plans and payment amounts on this page.
How Do I See My License?
If you know the email address your license was purchase under, you can view your license details, including what sites it is being used on and the transaction history by logging in to your account.
See also this help page for articles on your Gravity Forms account page.
How Can I Get A Refund?
A refund can be requested from within your account. See this guide.
How Can I Get More Info?
We have a host of quick-read help guides on this very website. Try starting here for articles about your license and account.
If you do not know the email address the license was purchased against, you can contact our support team here. We will require details about the purchase method used, so please include:

date of purchase
first 3 digits and final 4 digits of the credit card used.
name on the card

What is Gravity Forms?

What is Gravity Forms?

What It IsWhat It Isn』tWhere To Start

What It Is

Gravity Forms is a WordPress plugin that allows site owners, admins and developers to create simple and complex forms to collect information on their WordPress site, and then decide what to do with that information. Gravity Forms can be used for contact forms, WordPress post creation, calculators, employment applications and more. Check out this library of available templates for just a taste of some of the things you can do.

Additionally, we also offer numerous official add-ons ​that help you integrate your form submissions with numerous external services (such as Stripe, PayPal, Square, Zapier or MailChimp). See a full list of official add-ons here.

On top of that, we offer a robust number of WordPress hooks and a fully featured API to enable developers to modify and extend the functionality we provide, and enable third parties to produce extensive number of additions to the core functionality. Refer to our developer documentation, and our repository of third party add-ons that work with Gravity Forms for a sample of what exists.

Written in PHP, Gravity Forms uses many WordPress built-in functions and features to power its form builder. It also uses the same MySQL database system as WordPress, but stores all forms and entries in its own tables. Gravity Forms is open source and GPL licensed. All of the code included is unencrypted.

What It Isn』t

Gravity Forms is not a SaaS service. We do not host your forms, collect or store your form submissions. All that takes place on your designated WordPress website host where you install Gravity Forms.

Gravity Forms is not a design agency. We cannot contract to design or integrate your forms into your website.

We at Gravity Forms are not available for custom coding. But the fine developers at Codeable are!

Where To Start

If you are new to Gravity Forms, try starting your adventure into wonderful forms with this helpful Getting Started checklist.

Check out our informative blog for a host of getting started articles and the latest news.

Or reach out to our team via our Contact Us form if you have further questions.

What is a Feed?

What is a Feed?

A feed is like a notification that communicates information to an add-on or to an external service that the add-on integrates with, each time a visitor successfully submits your form.
Whereas a notification will fire an email off to a destination of your choice each time a Gravity Forms submission is completed, a 「feed」 is set-up within an add-on in order to define the way your form will notify the add-on (and potentially an external service) of a submission.
The reason to do this is because you want the external service to do something with it, such as:

send information to a customer management system in order to create a new customer record. E.g. Agile CRM Add-On or ActiveCampaign Add-On.
send information to a payment gateway in order to generate a charge. E.g. Paypal Payments Standard Add-On or 2Checkout Add-On.
send information to a ticketing service to initiate a support request. E.g. Help Scout Add-On.
send information to a communication service to generate a message in that service. E.g. Slack Add-On.
send file information to a storage service. E.g. Dropbox Add-On.

In general when setting up a feed for an external service, you will have to setup the following:

configure an API key or unique identifier that allows the external service to securely identify your submissions as coming from you. This is usually done within the Add-On Settings.
identify the form you want to use to send the information.
map the form fields to the external service fields you want to populate. For example, identifying which phone number field on your form is going to be sent to a CMS service to create a new custom record.
if needed, set any conditional logic you need in order to describe the conditions you want the submission to be sent using your feed. For example, you may only want the customer details to be sent using the 「new customer」 feed when a form field is set to 「new customer」, else you will want to fire the 「update customer」 feed. For information on enabling conditional logic for a feed, please see this article.

For specific instructions on setting up your feeds, refer to the user guide for each add-on.
Note: A feed must be present and active at the time of form submission in order to send information to the external service. Entries created without an active feed will not be sent to the service. Creating a feed afterwards will not process any entries previously submitted.
Tip: If you cannot find an Add-On that supports the specific external service you want to integrate your form with, then try the Zapier Add-On, which is a service expressly designed for providing hundreds of integrations with other services.

Website

Website

SummaryCommon SettingsMerge TagsUsageModifiersValidation

Summary

The Website field allows users to enter a website URL. This field automatically validates that the information entered was formatted correctly. It is available under the Advanced Fields section within the form editor.

Website field as displayed in the Field Library

Website field as displayed in the Form Editor.

Common Settings

This field uses only common field settings for the General, Appearance, and Advanced settings. For a description of each of the common field settings, refer to this article. Below you will find description of specialty settings that are particular to this field.

Merge Tags

For more information on the use of merge tags, refer to these articles.

Usage

{Field Name:2}

Notes:

The first of these merge tag parameters is optional and is simply the field name for easier identification.The second parameter defines the field ID within the form. In the example above, it would be field ID 2.

Modifiers

This field does not have any modifiers.

Validation

URLs submitted through this field are validated by GFCommon::is_valid_url(). For more information on how URLs are validated, and overriding them, take a look at the article on URL validation in Gravity Forms.

Website Field CSS Selectors

Website Field CSS Selectors

ContainerInput

Container
example: website field container (div) – applies to all forms
body .gform_wrapper .gform_body .gform_fields .gfield .ginput_container_website {border: 1px solid red;}
example: website field container (div) – applies just to form ID #1
body .gform_wrapper_1 .gform_body .gform_fields .gfield .ginput_container_website {border: 1px solid red;}
example: website field container (div) – applies just to specific container (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
body .gform_wrapper_1 .gform_body .gform_fields #field_XX_X.gfield .ginput_container_website {border: 1px solid red;}
Input
example: website field input (input) – applies to all forms
body .gform_wrapper .gform_body .gform_fields .gfield .ginput_container_website input {border: 1px solid red;}
example: website field input (input) – applies just to form ID #1
body .gform_wrapper_1 .gform_body .gform_fields .gfield .ginput_container_website input {border: 1px solid red;}
example: website field input (input) – applies just to specific container (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
body .gform_wrapper_1 .gform_body .gform_fields #field_XX_X.gfield .ginput_container_website input {border: 1px solid red;}

Webhooks Change Log

Webhooks Change Log

1.5 | 2021-05-061.4 | 2020-09-101.3 | 2020-05-131.2 | 2019-04-251.1 | 2017-08-231.0 | 2017-08-08

1.5 | 2021-05-06

Fixed an issue that prevents saving feed settings for a request URL that contains encoded values.
Fixed an issue where the add-on icon is missing on the Form Settings page for Gravity Forms 2.5.
Fixed an issue where script tags are being output above the document head element.

1.4 | 2020-09-10

Added support for Gravity Forms 2.5.

1.3 | 2020-05-13

Added translations for Hebrew, Hindi, Japanese, and Turkish.
Added security enhancements.
Updated stylesheets to use minified versions.
Fixed a PHP error which could occur when using the https_local_ssl_verify filter with WP 5.1+.

1.2 | 2019-04-25

Added "gform_webhooks_post_request" action.
Added GPL to plugin header.
Added support for delaying feed processing until after payment has been successfully completed using the PayPal Standard Add-On.
Added support for feed duplication.
Added support for using the {admin_ajax_url} and {rest_api_url} merge tags in the Request URL setting.
Updated logging statement.
Updated Plugin URI and Author URI to use https.

1.1 | 2017-08-23

Fixed data from selected fields not being included in the request.

1.0 | 2017-08-08

It's all new!

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.

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

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.

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.