Back

Gravity Forms API Essential Guide

Aug 1, 20246 minute read

What type of API does Gravity Forms provide?

Gravity Forms uses a REST API.

The REST API v2 is the latest version, incorporated into Gravity Forms core since version 2.4 (released in 2018).

The REST API v2:

  • Is an extension of the WordPress REST API
  • Allows creating, reading, updating and deleting forms, entries, and results over HTTP
  • Uses JSON or XML as the data format
  • Supports authentication via Gravity Forms credentials or WordPress authentication methods

The base URI for v2 is: /wp-json/gf/v2/

Does the Gravity Forms API have webhooks?

The Gravity Forms Webhooks Add-On allows you to trigger webhooks on form submissions. You can configure webhooks for a form by going to Form Settings -> Webhooks tab and clicking "Add New" to create a new webhook feed. This add-on enables you to make remote HTTP requests to external services when a form is submitted, allowing you to pass form data to 3rd party services even when there isn't an official add-on available.

When configuring a webhook, you can specify the request URL, request method, and request format. You can also set conditions for when a webhook should be triggered based on form field values. The add-on provides merge tags like {rest_api_url} and {admin_ajax_url} that can be used in webhook configurations.

Webhooks can be used to integrate with various services, such as creating Events Calendar events, creating tickets in WSDesk, or populating WebMerge documents. The configuration of the webhook request will vary based on the service you're connecting to.

The Webhooks Add-On primarily focuses on triggering webhooks when forms are submitted, rather than providing a subscription-based webhook system for various events within Gravity Forms.

Rate Limits and other limitations

Based on the search results provided, there is no specific information about API rate limits for the Gravity Forms API. However, I can provide some key points about the Gravity Forms API based on the available information:

Key Points:

  1. The Gravity Forms API is currently on version 2 (REST API v2), which was incorporated into Gravity Forms core from version 2.4 onwards.

  2. The API can be accessed as a route from the WordPress REST API, with a base URI of "gf/v2".

  3. The API supports various operations on forms, entries, and other Gravity Forms data.

  4. Authentication for external applications is done using an expiring signature method, similar to Amazon's S3 Storage API.

  5. The API uses WordPress and Gravity Forms role-based authorization to ensure that requests are allowed to be fulfilled.

  6. Cookie authentication is also supported for logged-in WordPress users, with nonces used to prevent CSRF issues.

API Rate Limits:

While there is no explicit mention of API rate limits for the Gravity Forms API, there is a related filter for Stripe error rate limiting:

add_filter( 'gform_stripe_enable_rate_limits', 'your_function_name' );

This filter enables the ability to disable or specifically enable error rate limiting when a Stripe feed is processed. By default, error rate limiting is enabled, blocking for an hour any IP reaching 5 errors.

Best Practices:

  1. When retrieving entries, use the Paging parameter to limit the number of entries to avoid database timeouts. The recommended optimum page size is 200 entries.

  2. For security, always use proper authentication methods when making API requests.

  3. Be aware of the capabilities required for different API operations (e.g., 'gravityforms_view_entries' for viewing entries).

  4. When working with large amounts of data, consider implementing paging, sorting, and search parameters to optimize your requests.

In conclusion, while there are no specific API rate limits mentioned for the Gravity Forms API itself, it's always a good practice to implement reasonable limits in your applications to avoid overloading the server. If you need more precise information about rate limits, it would be best to contact Gravity Forms support directly or check their most up-to-date documentation.

Latest API Version

Based on the search results provided, the most recent version of the Gravity Forms API appears to be version 2.8.11. Here are the key points:

  1. The latest release mentioned is Gravity Forms 2.8.11.

  2. This version contains a fix for an issue where some forms were broken due to a missing gform variable caused by recent changes to the Dom_Parser class.

  3. The changelog for version 2.8.11 specifically mentions this fix.

  4. The search results also mention earlier versions like 2.7.16 (from October 2023) and 2.7.5 (from May 2023), but these are older than 2.8.11.

  5. The REST API v2 was incorporated into Gravity Forms core from version 2.4, released in the Fall of 2018. This is not the most recent version, but it's worth noting as a significant milestone for the API.

  6. The documentation also mentions REST API v2, which is an extension of WordPress' REST API and allows developers to create, read, update, and delete forms, entries, and results over HTTP.

It's important to note that while 2.8.11 is the most recent version mentioned in these search results, there could potentially be even newer versions released after this information was compiled. For the most up-to-date information, it's always best to check the official Gravity Forms website or documentation.

How to get a Gravity Forms developer account and API Keys?

To get a developer account for Gravity Forms and API keys:

  1. Purchase a Gravity Forms Developer license or higher.

  2. Install and activate the Gravity Forms plugin on your WordPress site.

  3. Enable the REST API:

    • Go to Forms > Settings > REST API in your WordPress admin
    • Enable the REST API
    • Generate API keys for authentication
  4. Choose an authentication method:

    • Basic Authentication: Use your API key and secret
    • OAuth 1.0a: Set up an OAuth application
  5. Set up your development environment to make API requests.

  6. Start making API requests:

    • Use API endpoints to interact with forms, entries, and other Gravity Forms data
    • Base URL for API requests: https://your-site.com/wp-json/gf/v2/

Key points:

  • Use the latest version of Gravity Forms
  • Use HTTPS for secure API communication
  • Be mindful of API rate limits and best practices

Best practices:

  • Store API credentials securely
  • Use error handling in API requests
  • Keep Gravity Forms and API integration up to date
  • Test thoroughly in a development environment before deploying to production

What can you do with the Gravity Forms API?

Based on the search results provided, here is a list of data models you can interact with using the Gravity Forms API, along with what is possible for each:

Forms

  • Create new forms
  • Update existing forms
  • Get form details
  • Delete forms
  • Validate forms
  • Get form field filters
  • Submit forms

Entries

  • Create new entries
  • Update existing entries
  • Search and retrieve entries
  • Delete entries

Notifications

  • Send notifications

Add-On Feeds

  • Manage add-on feeds

Form Object

  • Access and modify form properties like title, fields, notifications, and confirmations

Field Object

  • Access and modify field settings
  • Dynamically change how fields are displayed

Notifications Object

  • Access and modify form notifications

Confirmations Object

  • Access and modify form confirmations

Conditional Logic Object

  • Control visibility of form elements based on user input
  • Determine if notifications, confirmations, or add-on feeds should be used

Button Object

  • Access and modify form button settings

Entry Object

  • Access entry properties like date created, client IP, and submitted field values

Additional Capabilities

  • Use hooks and filters to modify Gravity Forms behavior
  • Create custom field types using the Field Framework
  • Develop add-ons using the Add-On Framework
  • Interact with Gravity Forms data from external clients using the REST API

This list covers the main data models and interactions possible with the Gravity Forms API. The API provides extensive capabilities for manipulating forms, entries, and related data, as well as extending Gravity Forms functionality through hooks, filters, and custom development.