{"id":8823,"date":"2015-08-11T16:17:18","date_gmt":"2015-08-11T20:17:18","guid":{"rendered":"https:\/\/docs.gravityforms.com\/?post_type=gdoc&#038;p=8823"},"modified":"2019-02-12T11:56:42","modified_gmt":"2019-02-12T16:56:42","slug":"web-api-examples","status":"publish","type":"post","link":"https:\/\/docs.gravityforms.com\/web-api-examples\/","title":{"rendered":"v1 Examples"},"content":{"rendered":"<p>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.<\/p>\n<h2 id=\"h-entries\">Entries<\/h2>\n<h3 id=\"h-retrieve-entries\">Retrieve Entries<\/h3>\n<h4 id=\"h-retrieve-the-latest-10-entries-for-a-form\">Retrieve the latest 10 entries for a form<\/h4>\n<p>The example below retrieves the 10 most recent entries for form id 28. Paging is set to 10 by default.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\npublic static function calculate_signature( $string, $private_key ) {\r\n\t$hash = hash_hmac( 'sha1', $string, $private_key, true );\r\n\t$sig = rawurlencode( base64_encode( $hash ) );\r\n\treturn $sig;\r\n}\r\n\r\n$base_url = 'http:\/\/localhost\/wpdev\/gravityformsapi\/';\r\n$api_key = 'your_api_key';\r\n$private_key = 'your_private_key';\r\n$method  = 'GET';\r\n$route = 'forms\/28\/entries';\r\n$expires = strtotime( '+60 mins' );\r\n$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, $method, $route, $expires );\r\n$sig = self::calculate_signature( $string_to_sign, $private_key );\r\n\r\n$url = $base_url . $route . '?api_key=' . $api_key . '&amp;signature=' . $sig . '&amp;expires=' . $expires;\r\n\r\n$response = wp_remote_request( $url, array('method'\t=&gt; 'GET' ) );\r\n\r\nif ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){\r\n\t\/\/http request failed\r\n\techo 'There was an error attempting to access the API.';\r\n\tdie();\r\n}\r\n\r\n$body_json = wp_remote_retrieve_body( $response );\r\n\/\/results are in the &quot;body&quot; and are json encoded, decode them and put into an array\r\n$body = json_decode( $body_json, true );\r\n\r\n$data\t\t\t = $body&#x5B;'response'];\r\n$status_code\t = $body&#x5B;'status'];\r\n$total \t\t\t = 0;\r\n$total_retrieved = 0;\r\n\r\nif ( $status_code &lt;= 202 ){\r\n\t\/\/entries retrieved successfully\r\n\t$entries = $data&#x5B;'entries'];\r\n\t$status  = $status_code;\r\n\t$total \t\t\t\t= $data&#x5B;'total_count'];\r\n\t$total_retrieved \t= count( $entries );\r\n}\r\nelse {\r\n\t\/\/entry retrieval failed, get error information\r\n\t$error_code \t\t= $data&#x5B;'code'];\r\n\t$error_message \t\t= $data&#x5B;'message'];\r\n\t$error_data \t\t= isset( $data&#x5B;'data'] ) ? $data&#x5B;'data'] : '';\r\n\t$status \t\t\t= $status_code . ' - ' . $error_code . ' ' . $error_message . ' ' . $error_data;\r\n}\r\n\/\/display results in a simple page\r\n?&gt;\r\n&lt;html&gt;\r\n&lt;body&gt;\r\n&lt;form&gt;\r\n\t&lt;p&gt;Results&lt;\/p&gt;\r\n\t&lt;div&gt;Status Code: &lt;?php echo $status ?&gt;&lt;\/div&gt;\r\n\t&lt;div&gt;Total Count: &lt;?php echo $total; ?&gt;&lt;\/div&gt;\r\n\t&lt;div&gt;Total Retrieved: &lt;?php echo $total_retrieved; ?&gt;&lt;\/div&gt;\r\n\t&lt;div&gt;JSON Response:&lt;br\/&gt;&lt;textarea style=&quot;vertical-align: top&quot; cols=&quot;125&quot; rows=&quot;10&quot;&gt; &lt;?php echo $response&#x5B;'body']; ?&gt;&lt;\/textarea&gt;&lt;\/div&gt;\r\n\t&lt;br\/&gt;\r\n\t&lt;div&gt;\r\n\t\t&lt;?php\r\n\t\tif ( $total_retrieved &gt; 0 ) {\r\n\t\t\techo '&lt;table border=&quot;1&quot;&gt;&lt;th&gt;Form ID&lt;\/th&gt;&lt;th&gt;Entry ID&lt;\/th&gt;&lt;th&gt;Date Created&lt;\/th&gt;';\r\n\t\t\tforeach ( $entries as $entry ){\r\n\t\t\t\techo '&lt;tr&gt;&lt;td&gt;' . $entry&#x5B;'form_id'] . '&lt;\/td&gt;&lt;td&gt;' . $entry&#x5B;'id'] . '&lt;\/td&gt;&lt;td&gt;' . $entry&#x5B;'date_created'] . '&lt;\/td&gt;&lt;\/tr&gt;';\r\n\t\t\t}\r\n\t\t\techo '&lt;\/table&gt;';\r\n\t\t}\r\n\t\t?&gt;\r\n\t&lt;\/div&gt;\r\n&lt;\/form&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;script src=&quot;https:\/\/code.jquery.com\/jquery-1.10.2.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/rollups\/hmac-sha1.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/components\/enc-base64-min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\n\tfunction CalculateSig(stringToSign, privateKey){\r\n\t\t\/\/calculate the signature needed for authentication\r\n\t\tvar hash = CryptoJS.HmacSHA1(stringToSign, privateKey);\r\n\t\tvar base64 = hash.toString(CryptoJS.enc.Base64);\r\n\t\treturn encodeURIComponent(base64);\r\n\t}\r\n\r\n\t\/\/set variables\r\n\tvar d = new Date;\r\n\tvar expiration = 3600; \/\/ 1 hour,\r\n\tvar unixtime = parseInt(d.getTime() \/ 1000);\r\n\tvar future_unixtime = unixtime + expiration;\r\n\tvar\tpublicKey = &quot;your_public_key&quot;;\r\n\tvar\tprivateKey = &quot;your_private_key&quot;;\r\n\tvar\tmethod = &quot;GET&quot;;\r\n\tvar route = &quot;forms\/1\/entries&quot;;\r\n\r\n\tstringToSign = publicKey + &quot;:&quot; + method + &quot;:&quot; + route + &quot;:&quot; + future_unixtime;\r\n\tsig = CalculateSig(stringToSign, privateKey);\r\n\tvar url = 'http:\/\/localhost\/wp.dev\/gravityformsapi\/' + route + '?api_key=' + publicKey + '&amp;signature=' + sig + '&amp;expires=' + future_unixtime;\r\n\t$.get(url, function(data, textStatus)\r\n\t{\r\n\t\t\/\/get the data from the api\r\n\t\tif ( data.status != 200 || ( typeof( data ) != 'object' ) ) {\r\n\t\t\t\/\/http request failed\r\n\t\t\tdocument.write( 'There was an error attempting to access the API - ' + data.status + ': ' + data.response );\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tresponse \t\t  = data.response;\r\n\t\tentries \t\t  = response.entries; \/\/entries is a collection of Entry objects\r\n\t\ttotal_count \t  = response.total_count;\r\n\t});\r\n\r\n&lt;\/script&gt;\r\n<\/pre>\n<p>The response from this example will look like the following if successful:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n {&quot;status&quot;:200,&quot;response&quot;:{&quot;total_count&quot;:&quot;22&quot;,&quot;entries&quot;:&#x5B;{&quot;id&quot;:&quot;171&quot;,&quot;form_id&quot;:&quot;28&quot;,&quot;date_created&quot;:&quot;2015-06-15 22:43:23&quot;,&quot;is_starred&quot;:0,&quot;is_read&quot;:1,&quot;ip&quot;:&quot;::1&quot;,&quot;source_url&quot;:&quot;http:\\\/\\\/localhost\\\/wpdev\\\/?gf_page=preview&amp;id=28&quot;,&quot;post_id&quot;:null,&quot;currency&quot;:&quot;USD&quot;,&quot;payment_status&quot;:null,&quot;payment_date&quot;:null,&quot;transaction_id&quot;:null,&quot;payment_amount&quot;:null,&quot;payment_method&quot;:&quot;&quot;,&quot;is_fulfilled&quot;:null,&quot;created_by&quot;:&quot;1&quot;,&quot;transaction_type&quot;:null,&quot;user_agent&quot;:&quot;Mozilla\\\/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko\\\/20100101 Firefox\\\/38.0&quot;,&quot;status&quot;:&quot;active&quot;,&quot;1.3&quot;:&quot;Manual&quot;,&quot;1.6&quot;:&quot;Creation2&quot;,&quot;2&quot;:&quot;create entry x&quot;,&quot;3&quot;:&quot;create entry 2&quot;,&quot;1.2&quot;:&quot;&quot;,&quot;1.4&quot;:&quot;&quot;,&quot;1.8&quot;:&quot;&quot;},{&quot;id&quot;:&quot;170&quot;,&quot;form_id&quot;:&quot;28&quot;,&quot;date_created&quot;:&quot;2015-06-15 22:43:23&quot;,&quot;is_starred&quot;:0,&quot;is_read&quot;:1,&quot;ip&quot;:&quot;::1&quot;,&quot;source_url&quot;:&quot;http:\\\/\\\/localhost\\\/wpdev\\\/?gf_page=preview&amp;id=28&quot;,&quot;post_id&quot;:null,&quot;currency&quot;:&quot;USD&quot;,&quot;payment_status&quot;:null,&quot;payment_date&quot;:null,&quot;transaction_id&quot;:null,&quot;payment_amount&quot;:null,&quot;payment_method&quot;:&quot;&quot;,&quot;is_fulfilled&quot;:null,&quot;created_by&quot;:&quot;1&quot;,&quot;transaction_type&quot;:null,&quot;user_agent&quot;:&quot;Mozilla\\\/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko\\\/20100101 Firefox\\\/38.0&quot;,&quot;status&quot;:&quot;active&quot;,&quot;1.3&quot;:&quot;Manual&quot;,&quot;1.6&quot;:&quot;Creation1&quot;,&quot;2&quot;:&quot;create entry x&quot;,&quot;3&quot;:&quot;create entry with form id specified&quot;,&quot;1.2&quot;:&quot;&quot;,&quot;1.4&quot;:&quot;&quot;,&quot;1.8&quot;:&quot;&quot;},{&quot;id&quot;:&quot;169&quot;,&quot;form_id&quot;:&quot;28&quot;,&quot;date_created&quot;:&quot;2015-06-15 22:43:23&quot;,&quot;is_starred&quot;:0,&quot;is_read&quot;:1,&quot;ip&quot;:&quot;::1&quot;,&quot;source_url&quot;:&quot;http:\\\/\\\/localhost\\\/wpdev\\\/?gf_page=preview&amp;id=28&quot;,&quot;post_id&quot;:null,&quot;currency&quot;:&quot;USD&quot;,&quot;payment_status&quot;:null,&quot;payment_date&quot;:null,&quot;transaction_id&quot;:null,&quot;payment_amount&quot;:null,&quot;payment_method&quot;:&quot;&quot;,&quot;is_fulfilled&quot;:null,&quot;created_by&quot;:&quot;1&quot;,&quot;transaction_type&quot;:null,&quot;user_agent&quot;:&quot;Mozilla\\\/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko\\\/20100101 Firefox\\\/38.0&quot;,&quot;status&quot;:&quot;active&quot;,&quot;1.3&quot;:&quot;Manual&quot;,&quot;1.6&quot;:&quot;Creation2&quot;,&quot;2&quot;:&quot;create entry 2&quot;,&quot;3&quot;:&quot;create entry 2&quot;,&quot;1.2&quot;:&quot;&quot;,&quot;1.4&quot;:&quot;&quot;,&quot;1.8&quot;:&quot;&quot;},{&quot;id&quot;:&quot;168&quot;,&quot;form_id&quot;:&quot;28&quot;,&quot;date_created&quot;:&quot;2015-06-15 22:43:23&quot;,&quot;is_starred&quot;:0,&quot;is_read&quot;:1,&quot;ip&quot;:&quot;::1&quot;,&quot;source_url&quot;:&quot;http:\\\/\\\/localhost\\\/wpdev\\\/?gf_page=preview&amp;id=28&quot;,&quot;post_id&quot;:null,&quot;currency&quot;:&quot;USD&quot;,&quot;payment_status&quot;:null,&quot;payment_date&quot;:null,&quot;transaction_id&quot;:null,&quot;payment_amount&quot;:null,&quot;payment_method&quot;:&quot;&quot;,&quot;is_fulfilled&quot;:null,&quot;created_by&quot;:&quot;1&quot;,&quot;transaction_type&quot;:null,&quot;user_agent&quot;:&quot;Mozilla\\\/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko\\\/20100101 Firefox\\\/38.0&quot;,&quot;status&quot;:&quot;active&quot;,&quot;1.3&quot;:&quot;Manual&quot;,&quot;1.6&quot;:&quot;Creation1&quot;,&quot;2&quot;:&quot;create entry&quot;,&quot;3&quot;:&quot;create entry with form id specified&quot;,&quot;1.2&quot;:&quot;&quot;,&quot;1.4&quot;:&quot;&quot;,&quot;1.8&quot;:&quot;&quot;},{&quot;id&quot;:&quot;167&quot;,&quot;form_id&quot;:&quot;28&quot;,&quot;date_created&quot;:&quot;2015-06-15 22:43:23&quot;,&quot;is_starred&quot;:0,&quot;is_read&quot;:1,&quot;ip&quot;:&quot;::1&quot;,&quot;source_url&quot;:&quot;http:\\\/\\\/localhost\\\/wpdev\\\/?gf_page=preview&amp;id=28&quot;,&quot;post_id&quot;:null,&quot;currency&quot;:&quot;USD&quot;,&quot;payment_status&quot;:null,&quot;payment_date&quot;:null,&quot;transaction_id&quot;:null,&quot;payment_amount&quot;:null,&quot;payment_method&quot;:&quot;&quot;,&quot;is_fulfilled&quot;:null,&quot;created_by&quot;:&quot;1&quot;,&quot;transaction_type&quot;:null,&quot;user_agent&quot;:&quot;Mozilla\\\/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko\\\/20100101 Firefox\\\/38.0&quot;,&quot;status&quot;:&quot;active&quot;,&quot;1.3&quot;:&quot;Manual&quot;,&quot;1.6&quot;:&quot;Creation2&quot;,&quot;2&quot;:&quot;create entry 2&quot;,&quot;3&quot;:&quot;create entry 2&quot;,&quot;1.2&quot;:&quot;&quot;,&quot;1.4&quot;:&quot;&quot;,&quot;1.8&quot;:&quot;&quot;},{&quot;id&quot;:&quot;166&quot;,&quot;form_id&quot;:&quot;28&quot;,&quot;date_created&quot;:&quot;2015-06-15 22:43:23&quot;,&quot;is_starred&quot;:0,&quot;is_read&quot;:1,&quot;ip&quot;:&quot;::1&quot;,&quot;source_url&quot;:&quot;http:\\\/\\\/localhost\\\/wpdev\\\/?gf_page=preview&amp;id=28&quot;,&quot;post_id&quot;:null,&quot;currency&quot;:&quot;USD&quot;,&quot;payment_status&quot;:null,&quot;payment_date&quot;:null,&quot;transaction_id&quot;:null,&quot;payment_amount&quot;:null,&quot;payment_method&quot;:&quot;&quot;,&quot;is_fulfilled&quot;:null,&quot;created_by&quot;:&quot;1&quot;,&quot;transaction_type&quot;:null,&quot;user_agent&quot;:&quot;Mozilla\\\/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko\\\/20100101 Firefox\\\/38.0&quot;,&quot;status&quot;:&quot;active&quot;,&quot;1.3&quot;:&quot;Manual&quot;,&quot;1.6&quot;:&quot;Creation1&quot;,&quot;2&quot;:&quot;create entry&quot;,&quot;3&quot;:&quot;create entry with form id specified&quot;,&quot;1.2&quot;:&quot;&quot;,&quot;1.4&quot;:&quot;&quot;,&quot;1.8&quot;:&quot;&quot;},{&quot;id&quot;:&quot;165&quot;,&quot;form_id&quot;:&quot;28&quot;,&quot;date_created&quot;:&quot;2015-06-15 22:43:23&quot;,&quot;is_starred&quot;:0,&quot;is_read&quot;:1,&quot;ip&quot;:&quot;::1&quot;,&quot;source_url&quot;:&quot;http:\\\/\\\/localhost\\\/wpdev\\\/?gf_page=preview&amp;id=28&quot;,&quot;post_id&quot;:null,&quot;currency&quot;:&quot;USD&quot;,&quot;payment_status&quot;:null,&quot;payment_date&quot;:null,&quot;transaction_id&quot;:null,&quot;payment_amount&quot;:null,&quot;payment_method&quot;:&quot;&quot;,&quot;is_fulfilled&quot;:null,&quot;created_by&quot;:&quot;1&quot;,&quot;transaction_type&quot;:null,&quot;user_agent&quot;:&quot;Mozilla\\\/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko\\\/20100101 Firefox\\\/38.0&quot;,&quot;status&quot;:&quot;active&quot;,&quot;1.3&quot;:&quot;Manual&quot;,&quot;1.6&quot;:&quot;Creation2&quot;,&quot;2&quot;:&quot;create entry 2&quot;,&quot;3&quot;:&quot;create entry 2&quot;,&quot;1.2&quot;:&quot;&quot;,&quot;1.4&quot;:&quot;&quot;,&quot;1.8&quot;:&quot;&quot;},{&quot;id&quot;:&quot;164&quot;,&quot;form_id&quot;:&quot;28&quot;,&quot;date_created&quot;:&quot;2015-06-15 22:43:23&quot;,&quot;is_starred&quot;:0,&quot;is_read&quot;:1,&quot;ip&quot;:&quot;::1&quot;,&quot;source_url&quot;:&quot;http:\\\/\\\/localhost\\\/wpdev\\\/?gf_page=preview&amp;id=28&quot;,&quot;post_id&quot;:null,&quot;currency&quot;:&quot;USD&quot;,&quot;payment_status&quot;:null,&quot;payment_date&quot;:null,&quot;transaction_id&quot;:null,&quot;payment_amount&quot;:null,&quot;payment_method&quot;:&quot;&quot;,&quot;is_fulfilled&quot;:null,&quot;created_by&quot;:&quot;1&quot;,&quot;transaction_type&quot;:null,&quot;user_agent&quot;:&quot;Mozilla\\\/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko\\\/20100101 Firefox\\\/38.0&quot;,&quot;status&quot;:&quot;active&quot;,&quot;1.3&quot;:&quot;Manual&quot;,&quot;1.6&quot;:&quot;Creation1&quot;,&quot;2&quot;:&quot;create entry&quot;,&quot;3&quot;:&quot;create entry with form id specified&quot;,&quot;1.2&quot;:&quot;&quot;,&quot;1.4&quot;:&quot;&quot;,&quot;1.8&quot;:&quot;&quot;},{&quot;id&quot;:&quot;163&quot;,&quot;form_id&quot;:&quot;28&quot;,&quot;date_created&quot;:&quot;2015-07-01 20:03:09&quot;,&quot;is_starred&quot;:0,&quot;is_read&quot;:1,&quot;ip&quot;:&quot;::1&quot;,&quot;source_url&quot;:&quot;http:\\\/\\\/localhost\\\/wpdev\\\/?gf_page=preview&amp;id=28&quot;,&quot;post_id&quot;:null,&quot;currency&quot;:&quot;USD&quot;,&quot;payment_status&quot;:null,&quot;payment_date&quot;:null,&quot;transaction_id&quot;:null,&quot;payment_amount&quot;:null,&quot;payment_method&quot;:null,&quot;is_fulfilled&quot;:null,&quot;created_by&quot;:&quot;1&quot;,&quot;transaction_type&quot;:null,&quot;user_agent&quot;:&quot;Mozilla\\\/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko\\\/20100101 Firefox\\\/38.0&quot;,&quot;status&quot;:&quot;spam&quot;,&quot;1.3&quot;:&quot;July&quot;,&quot;1.6&quot;:&quot;First&quot;,&quot;2&quot;:&quot;test&quot;,&quot;1.2&quot;:&quot;&quot;,&quot;1.4&quot;:&quot;&quot;,&quot;1.8&quot;:&quot;&quot;,&quot;3&quot;:&quot;&quot;},{&quot;id&quot;:&quot;162&quot;,&quot;form_id&quot;:&quot;28&quot;,&quot;date_created&quot;:&quot;2015-06-24 20:01:31&quot;,&quot;is_starred&quot;:0,&quot;is_read&quot;:0,&quot;ip&quot;:&quot;::1&quot;,&quot;source_url&quot;:&quot;http:\\\/\\\/localhost\\\/wpdev\\\/?gf_page=preview&amp;id=28&quot;,&quot;post_id&quot;:null,&quot;currency&quot;:&quot;USD&quot;,&quot;payment_status&quot;:null,&quot;payment_date&quot;:null,&quot;transaction_id&quot;:null,&quot;payment_amount&quot;:null,&quot;payment_method&quot;:null,&quot;is_fulfilled&quot;:null,&quot;created_by&quot;:&quot;1&quot;,&quot;transaction_type&quot;:null,&quot;user_agent&quot;:&quot;Mozilla\\\/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko\\\/20100101 Firefox\\\/38.0&quot;,&quot;status&quot;:&quot;trash&quot;,&quot;1.3&quot;:&quot;d5&quot;,&quot;1.6&quot;:&quot;d5&quot;,&quot;2&quot;:&quot;d5&quot;,&quot;1.2&quot;:&quot;&quot;,&quot;1.4&quot;:&quot;&quot;,&quot;1.8&quot;:&quot;&quot;,&quot;3&quot;:&quot;&quot;}]}}\r\n<\/pre>\n<p>If no entries are located for the specified form, the response will look like the following:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n {&quot;status&quot;:200,&quot;response&quot;:{&quot;total_count&quot;:&quot;0&quot;,&quot;entries&quot;:&#x5B;]}}\r\n<\/pre>\n<h4 id=\"h-retrieve-all-entries-for-a-form\">Retrieve all entries for a form<\/h4>\n<p>To retrieve all entries for a form, you may specify the page size within the URL&#8217;s querystring. To do this, you may use the example above and add the querystring parameter &#8220;&amp;paging[page_size]=&#8221; 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 <a href=\"https:\/\/docs.gravityforms.com\/web-api#paging\" target=\"_blank\">Paging<\/a> section in the <a href=\"https:\/\/docs.gravityforms.com\/web-api\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nhttp:\/\/localhost\/wpdev\/gravityformsapi\/forms\/28\/entries\/?paging&#x5B;page_size]=1000\r\n<\/pre>\n<h4 id=\"h-retrieve-entries-sorted-by-a-specific-field\">Retrieve entries sorted by a specific field<\/h4>\n<p>To retrieve entries and have them sorted by a specific field, you may specify the sorting key within the URL&#8217;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 <a href=\"https:\/\/docs.gravityforms.com\/web-api#sorting\" target=\"_blank\">Sorting<\/a> section in the <a href=\"https:\/\/docs.gravityforms.com\/web-api\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nhttp:\/\/localhost\/wpdev\/gravityformsapi\/forms\/28\/entries\/?sorting&#x5B;key]=1.3\r\n<\/pre>\n<h4 id=\"h-retrieve-entries-sorted-ascending\">Retrieve entries sorted ascending<\/h4>\n<p>To retrieve entries and have them sorted ascending, instead of the default descending, you may specify the sorting direction within the URL&#8217;s querystring. In the example below, the direction is set to &#8220;ASC&#8221; 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 <a href=\"https:\/\/docs.gravityforms.com\/web-api#sorting\" target=\"_blank\">Sorting<\/a> section in the <a href=\"https:\/\/docs.gravityforms.com\/web-api\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nhttp:\/\/localhost\/wpdev\/gravityformsapi\/forms\/28\/entries\/?sorting&#x5B;direction]=ASC\r\n<\/pre>\n<h4 id=\"h-retrieve-entries-by-status\">Retrieve entries by status<\/h4>\n<p>The example below retrieves entries that are currently in the trash. To see more information about retrieving entries with search criteria, check out the <a href=\"https:\/\/docs.gravityforms.com\/web-api#search-criteria\" target=\"_blank\">Search Criteria<\/a> section the <a href=\"https:\/\/docs.gravityforms.com\/web-api\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nhttp:\/\/localhost\/wpdev\/gravityformsapi\/forms\/28\/entries\/?search&#x5B;status]=trash\r\n<\/pre>\n<h4 id=\"h-retrieve-entries-more-recent-than-a-specific-date\">Retrieve entries more recent than a specific date<\/h4>\n<p>The example below retrieves entries which have been created on 06\/24\/2014 or are newer.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nhttp:\/\/localhost\/wpdev\/gravityformsapi\/forms\/28\/entries\/?search&#x5B;start_date]=2015-06-24\r\n<\/pre>\n<h4 id=\"h-retrieve-entries-for-a-date-range\">Retrieve entries for a date range<\/h4>\n<p>The example below retrieves entries that were created on 06\/15\/2015 through 06\/24\/2015 (inclusive).<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nhttp:\/\/localhost\/wpdev\/gravityformsapi\/forms\/28\/entries\/?search&#x5B;start_date]=2015-06-15&search&#x5B;end_date]=2015-06-24\r\n<\/pre>\n<h4 id=\"h-retrieve-entries-using-field-filters-one-condition\">Retrieve entries using field filters (one condition)<\/h4>\n<p>The example below retrieves entries where the last name field (id 1.6) is &#8220;Draven&#8221;. 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 <a href=\"https:\/\/docs.gravityforms.com\/web-api#field-filters\" target=\"_blank\">Field Filters<\/a> section in the <a href=\"https:\/\/docs.gravityforms.com\/web-api\" target=\"_blank\">REST API v1<\/a> article<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/create the field filter array with key, operator, value and place it inside another array\r\n$field_filters = array (\r\n                     array(\r\n                         'key'      =&gt; '1.6',\r\n                         'operator' =&gt; 'is',\r\n                         'value' =&gt; 'Draven'\r\n                     )\r\n                 );\r\n\r\n\/\/set field_filters to array\r\n$search&#x5B;'field_filters'] = $field_filters;\r\n\r\n\/\/convert the array to a JSON string and url encode it so the JSON formatting persists\r\n$search_json = urlencode( json_encode( $search ) );\r\n\r\n\/\/include field filters in search querystring parameter\r\n$url = $base_url . $route . '?api_key=' . $api_key . '&amp;signature=' . $sig . '&amp;expires=' . $expires . '&amp;paging&#x5B;page_size]=1000&amp;search=' . $search_json;\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nvar search = {\r\n\t\tfield_filters : &#x5B;\r\n\t\t\t{\r\n\t\t\t\tkey: '2.6',\r\n\t\t\t\tvalue: 'Harris',\r\n\t\t\t\toperator: 'is'\r\n\t\t\t}\r\n\t\t]\r\n\t};\r\n\r\n\/\/convert to a JSON string and url encode it so the JSON formatting persists\r\nsearch = encodeURI(JSON.stringify(search));\r\n\r\n\/\/add search to url\r\nurl += '&amp;search=' + search;\r\n\r\n<\/pre>\n<p>The JSON string created by the code above and used in the querystring will look like the following before it is URL encoded:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n{&quot;field_filters&quot;:&#x5B;{&quot;key&quot;:&quot;1.6&quot;,&quot;operator&quot;:&quot;is&quot;,&quot;value&quot;:&quot;Draven&quot;}]}\r\n<\/pre>\n<h4 id=\"h-retrieve-entries-using-field-filters-multiple-conditions\">Retrieve entries using field filters (multiple conditions)<\/h4>\n<p>The example below retrieves entries where the last name field (1.6) is &#8220;Draven&#8221; and the first name field (1.3) is not &#8220;Eric&#8221;. If all conditions specified need to be met, the &#8220;mode&#8221; is set to &#8220;all&#8221; (the keyword &#8220;AND&#8221; is used in the database query). If all conditions are not necessary, set the &#8220;mode&#8221; to &#8220;any&#8221; (the keyword &#8220;OR&#8221; is used in the database query). The default mode is &#8220;all&#8221; so you do not need to include it when all conditions are required. To see more information about using field filters, check out the <a href=\"https:\/\/docs.gravityforms.com\/web-api#field-filters\" target=\"_blank\">Field Filters<\/a> section in the <a href=\"https:\/\/docs.gravityforms.com\/web-api\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$field_filters = array (\r\n                     'mode' =&gt; 'any',\r\n                     array(\r\n                         'key'      =&gt; '1.6',\r\n                         'operator' =&gt; 'is',\r\n                         'value'    =&gt; 'Draven'\r\n                     ),\r\n                     array(\r\n                         'key'      =&gt; '1.3',\r\n                         'operator' =&gt; 'isnot',\r\n                         'value'    =&gt; 'Eric'\r\n                     ),\r\n                 );\r\n$search&#x5B;'field_filters'] = $field_filters;\r\n$search_json = urlencode( json_encode( $search ) );\r\n\r\n$url = $base_url . $route . '?api_key=' . $api_key . '&amp;signature=' . $sig . '&amp;expires=' . $expires . '&amp;paging&#x5B;page_size]=1000&amp;search=' . $search_json;\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nvar search = {\r\n\t\tfield_filters : &#x5B;\r\n\t\t\t{\r\n\t\t\t\tkey: '2.6',\r\n\t\t\t\tvalue: 'Harris',\r\n\t\t\t\toperator: 'is'\r\n\t\t\t},\r\n                        {\r\n\t\t\t\tkey: '2.3',\r\n\t\t\t\tvalue:'Xander',\r\n\t\t\t\toperator: 'is'\r\n\t\t\t}\r\n\t\t]\r\n\t};\r\n\r\n\/\/convert to a JSON string and url encode it so the JSON formatting persists\r\nsearch = encodeURI(JSON.stringify(search));\r\n\r\n\/\/add search to url\r\nurl += '&amp;search=' + search;\r\n<\/pre>\n<p>The JSON string created by the code above and used in the querystring will look like the following before it is URL encoded:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n{&quot;field_filters&quot;:{&quot;mode&quot;:&quot;any&quot;,&quot;0&quot;:{&quot;key&quot;:&quot;1.6&quot;,&quot;operator&quot;:&quot;is&quot;,&quot;value&quot;:&quot;Draven&quot;},&quot;1&quot;:{&quot;key&quot;:&quot;1.3&quot;,&quot;operator&quot;:&quot;isnot&quot;,&quot;value&quot;:&quot;Eric&quot;}}}\r\n<\/pre>\n<h4 id=\"h-retrieve-entries-using-field-filters-contains-condition\">Retrieve entries using field filters (contains condition)<\/h4>\n<p>The example below retrieves entries that have the text &#8220;er&#8221; as part of the last name field (id 1.6).<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$field_filters = array (\r\n                     array(\r\n                         'key'      =&gt; '1.6',\r\n                         'operator' =&gt; 'contains',\r\n                         'value'    =&gt; 'er'\r\n                     ),\r\n                 );\r\n$search&#x5B;'field_filters'] = $field_filters;\r\n$search_json = urlencode( json_encode( $search ) );\r\n\r\n$url = $base_url . $route . '?api_key=' . $api_key . '&amp;signature=' . $sig . '&amp;expires=' . $expires . '&amp;paging&#x5B;page_size]=1000&amp;search=' . $search_json;\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nvar search = {\r\n\t\tfield_filters : &#x5B;\r\n\t\t\t{\r\n\t\t\t\tkey: '2.6',\r\n\t\t\t\toperator: 'contains',\r\n\t\t\t\tvalue: 'er'\r\n\t\t\t}\r\n\t\t]\r\n\t};\r\n\r\n\/\/convert to a JSON string and url encode it so the JSON formatting persists\r\nsearch = encodeURI(JSON.stringify(search));\r\n\r\n\/\/add search to url\r\nurl += '&amp;search=' + search;\r\n\r\n<\/pre>\n<p>The JSON string created by the code above and used in the querystring will look like the following before it is URL encoded:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n{&quot;field_filters&quot;:&#x5B;{&quot;key&quot;:&quot;1.6&quot;,&quot;operator&quot;:&quot;contains&quot;,&quot;value&quot;:&quot;er&quot;}]}\r\n<\/pre>\n<h4 id=\"h-retrieve-entries-using-search-criteria-and-field-filters\">Retrieve entries using search criteria and field filters<\/h4>\n<p>The example below retrieves entries that have the text &#8220;Test&#8221; as part of the last name field (id 1.6) and have been created since 2016-10-10<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$field_filters = array (\r\n\t\t\tarray(\r\n\t\t\t\t'key' \t\t=&gt; '1.6',\r\n\t\t\t\t'operator'\t=&gt; 'contains',\r\n\t\t\t\t'value' \t=&gt; 'Test'\r\n\t\t\t),\r\n\t\t);\r\n\t\t$search = &#x5B;];\r\n\t\t$search&#x5B;'field_filters'] = $field_filters;\r\n\t\t$search&#x5B;'start_date'] = '2016-10-10';\r\n\t\t$search_json = urlencode( json_encode( $search ) );\r\n\r\n\t\t$url .= '&amp;search=' . $search_json;\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\nvar search = {\r\n\t\tfield_filters : &#x5B;\r\n\t\t\t{\r\n\t\t\t\tkey: '1.6',\r\n\t\t\t\toperator: 'contains',\r\n\t\t\t\tvalue: 'Test'\r\n\t\t\t}\r\n\t\t],\r\n\t\tstart_date : '2016-10-10'\r\n};\r\n\r\n\/\/convert to a JSON string and url encode it so the JSON formatting persists\r\nsearch = encodeURI(JSON.stringify(search));\r\n\r\n\/\/add search to url\r\nurl += '&amp;search=' + search;\r\n<\/pre>\n<p>The JSON string created by the code above and used in the querystring will look like the following before it is URL encoded:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n{&quot;field_filters&quot;:&#x5B;{&quot;key&quot;:&quot;1.6&quot;,&quot;operator&quot;:&quot;contains&quot;,&quot;value&quot;:&quot;Test&quot;}],&quot;start_date&quot;:&quot;2016-10-10&quot;}\r\n<\/pre>\n<h4 id=\"h-retrieve-entries-that-have-been-read\">Retrieve entries that have been read<\/h4>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$field_filters = array (\r\n                     array(\r\n                         'key'      =&gt; 'is_read',\r\n                         'operator' =&gt; 'is',\r\n                         'value'    =&gt; 1\r\n                     ),\r\n                 );\r\n$search&#x5B;'field_filters'] = $field_filters;\r\n$search_json = urlencode( json_encode( $search ) );\r\n\r\n$url = $base_url . $route . '?api_key=' . $api_key . '&amp;signature=' . $sig . '&amp;expires=' . $expires . '&amp;paging&#x5B;page_size]=1000&amp;search=' . $search_json;\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nvar search = {\r\n\t\tfield_filters : &#x5B;\r\n\t\t\t{\r\n\t\t\t\tkey: 'is_read',\r\n\t\t\t\toperator: 'is',\r\n\t\t\t\tvalue: 1\r\n\r\n\t\t\t}\r\n\t\t]\r\n\t};\r\n\r\n\/\/convert to a JSON string and url encode it so the JSON formatting persists\r\nsearch = encodeURI(JSON.stringify(search));\r\n\r\n\/\/add search to url\r\nurl += '&amp;search=' + search;\r\n\r\n<\/pre>\n<h4 id=\"h-retrieve-all-entries-with-paging\">Retrieve all entries with paging<\/h4>\n<p>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 <a href=\"https:\/\/docs.gravityforms.com\/web-api#paging\" target=\"_blank\">Paging<\/a> section of the <a href=\"https:\/\/docs.gravityforms.com\/web-api\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\npublic static function calculate_signature( $string, $private_key ) {\r\n\t$hash = hash_hmac( 'sha1', $string, $private_key, true );\r\n\t$sig = rawurlencode( base64_encode( $hash ) );\r\n\treturn $sig;\r\n}\r\n$base_url = 'http:\/\/localhost\/wpdev\/gravityformsapi\/';\r\n$api_key = '9419b823a1';\r\n$private_key = '4d7640ad3ffe2ec';\r\n$method  = 'GET';\r\n$route = 'entries';\r\n$expires = strtotime( '+60 mins' );\r\n$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, $method, $route, $expires );\r\n$sig = self::calculate_signature( $string_to_sign, $private_key );\r\n\r\n$page_size = 5;\r\n$offset = 0;\r\nif ( isset( $_GET&#x5B;'paging']&#x5B;'offset'] ) ){\r\n\t$offset = $_GET&#x5B;'paging']&#x5B;'offset'];\r\n}\r\n\r\n$url = $base_url . $route . '?api_key=' . $api_key . '&amp;signature=' . $sig . '&amp;expires=' . $expires . '&amp;paging&#x5B;$page_size]=' . $page_size . '&amp;paging&#x5B;offset]=' . $offset;\r\n\r\n$response = wp_remote_request( $url, array('method'\t=&gt; 'GET' ) );\r\n\r\nif ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){\r\n\t\/\/http request failed\r\n\techo 'There was an error attempting to access the API.';\r\n\tdie();\r\n}\r\n\r\n$body_json = wp_remote_retrieve_body( $response );\r\n\/\/results are in the &quot;body&quot; and are json encoded, decode them and put into an array\r\n$body = json_decode( $body_json, true );\r\n\r\n$data\t\t\t = $body&#x5B;'response'];\r\n$status_code\t = $body&#x5B;'status'];\r\n$total \t\t\t = 0;\r\n$total_retrieved = 0;\r\n\r\nif ( $status_code &lt;= 202 ){\r\n\t\/\/entries retrieved successfully\r\n\t$entries         = $data&#x5B;'entries'];\r\n\t$status          = $status_code;\r\n\t$total \t         = $data&#x5B;'total_count'];\r\n\t$total_retrieved = count( $entries );\r\n}\r\nelse {\r\n\t\/\/entry retrieval failed, get error information\r\n\t$error_code    = $data&#x5B;'code'];\r\n\t$error_message = $data&#x5B;'message'];\r\n\t$error_data    = isset( $data&#x5B;'data'] ) ? $data&#x5B;'data'] : '';\r\n\t$status \t   = $status_code . ' - ' . $error_code . ' ' . $error_message . ' ' . $error_data;\r\n}\r\n\/\/display results in a simple page\r\n?&gt;\r\n&lt;html&gt;\r\n&lt;body&gt;\r\n&lt;form&gt;\r\n\t&lt;p&gt;Results&lt;\/p&gt;\r\n\t&lt;div&gt;Status Code: &lt;?php echo $status ?&gt;&lt;\/div&gt;\r\n\t&lt;div&gt;Total Count: &lt;?php echo $total; ?&gt;&lt;\/div&gt;\r\n\t&lt;div&gt;Total Retrieved: &lt;?php echo $total_retrieved; ?&gt;&lt;\/div&gt;\r\n\t&lt;div&gt;JSON Response:&lt;br\/&gt;&lt;textarea style=&quot;vertical-align: top&quot; cols=&quot;125&quot; rows=&quot;10&quot;&gt; &lt;?php echo $response&#x5B;'body']; ?&gt;&lt;\/textarea&gt;&lt;\/div&gt;\r\n\t&lt;br\/&gt;\r\n\t&lt;div&gt;\r\n\t\t&lt;?php\r\n\t\tif ( $total_retrieved &gt; 0 ) {\r\n\t\t\techo '&lt;table border=&quot;1&quot;&gt;&lt;th&gt;Form ID&lt;\/th&gt;&lt;th&gt;Entry ID&lt;\/th&gt;&lt;th&gt;Date Created&lt;\/th&gt;';\r\n\t\t\tforeach ( $entries as $entry ){\r\n\t\t\t\techo '&lt;tr&gt;&lt;td&gt;' . $entry&#x5B;'form_id'] . '&lt;\/td&gt;&lt;td&gt;' . $entry&#x5B;'id'] . '&lt;\/td&gt;&lt;td&gt;' . $entry&#x5B;'date_created'] . '&lt;\/td&gt;&lt;\/tr&gt;';\r\n\t\t\t}\r\n\t\t\techo '&lt;\/table&gt;';\r\n\t\t}\r\n\r\n\t\tif ( $total &gt; $total_retrieved ){\r\n\t\t\t\/\/paging in effect\r\n\t\t\t$query_string = $_SERVER&#x5B;'QUERY_STRING'];\r\n\t\t\tparse_str( $query_string, $params );\r\n\t\t\t$paging_link = '';\r\n\t\t\tif ( $total_retrieved == $page_size ){\r\n\t\t\t\t\/\/see if previous link needs to be built\r\n\t\t\t\t$page_offset = isset( $params&#x5B;'paging']&#x5B;'offset'] ) ? $params&#x5B;'paging']&#x5B;'offset'] : 0;\r\n\t\t\t\tif ( $page_offset &lt;&gt; 0 ) {\r\n\t\t\t\t\t$previous_page_offset = $params&#x5B;'paging']&#x5B;'offset'] - $page_size;\r\n\t\t\t\t\tif ( $previous_page_offset &lt; 0 ){\r\n\t\t\t\t\t\t$previous_page_offset = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$params&#x5B;'paging']&#x5B;'offset'] = $previous_page_offset;\r\n\t\t\t\t\t$page_url = 'http:\/\/' . $_SERVER&#x5B;'HTTP_HOST'] . $_SERVER&#x5B;'SCRIPT_NAME'] . '?' . http_build_query( $params );\r\n\t\t\t\t\t$paging_link = '&lt;a href=&quot;' . $page_url . '&quot;&gt;Previous&lt;\/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;';\r\n\t\t\t\t}\r\n\t\t\t\t$params&#x5B;'paging']&#x5B;'offset'] = $page_offset + $page_size;\r\n\t\t\t\t$page_url = 'http:\/\/' . $_SERVER&#x5B;'HTTP_HOST'] . $_SERVER&#x5B;'SCRIPT_NAME'] . '?' . http_build_query( $params );\r\n\t\t\t\t$paging_link .= '&lt;a href=&quot;' . $page_url . '&quot;&gt;Next&lt;\/a&gt;';\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$page_offset = $params&#x5B;'paging']&#x5B;'offset'] - $page_size;\r\n\t\t\t\tif ( $page_offset &lt; 0 ){\r\n\t\t\t\t\t$page_offset = 0;\r\n\t\t\t\t}\r\n\t\t\t\t$params&#x5B;'paging']&#x5B;'offset'] = $page_offset;\r\n\t\t\t\t$page_url = 'http:\/\/' . $_SERVER&#x5B;'HTTP_HOST'] . $_SERVER&#x5B;'SCRIPT_NAME'] . '?' . http_build_query( $params );\r\n\t\t\t\t$paging_link = '&lt;a href=&quot;' . $page_url . '&quot;&gt;Previous&lt;\/a&gt;';\r\n\t\t\t}\r\n\r\n\t\t\techo $paging_link;\r\n\t\t}\r\n\t\t?&gt;\r\n\t&lt;\/div&gt;\r\n&lt;\/form&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;script src=&quot;https:\/\/code.jquery.com\/jquery-1.10.2.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/rollups\/hmac-sha1.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/components\/enc-base64-min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\n\tfunction CalculateSig(stringToSign, privateKey){\r\n\t\t\/\/calculate the signature needed for authentication\r\n\t\tvar hash = CryptoJS.HmacSHA1(stringToSign, privateKey);\r\n\t\tvar base64 = hash.toString(CryptoJS.enc.Base64);\r\n\t\treturn encodeURIComponent(base64);\r\n\t}\r\n\r\n\t\/\/set variables\r\n\tvar d = new Date;\r\n\tvar expiration = 3600; \/\/ 1 hour,\r\n\tvar unixtime = parseInt(d.getTime() \/ 1000);\r\n\tvar future_unixtime = unixtime + expiration;\r\n\tvar\tpublicKey = &quot;your_public_key&quot;;\r\n\tvar\tprivateKey = &quot;your_private_key&quot;;\r\n\tvar\tmethod = &quot;GET&quot;;\r\n\tvar route = &quot;forms\/1\/entries&quot;;\r\n        var page_size = 5;\r\n\r\n\tstringToSign = publicKey + &quot;:&quot; + method + &quot;:&quot; + route + &quot;:&quot; + future_unixtime;\r\n\tsig = CalculateSig(stringToSign, privateKey);\r\n\tvar url = 'http:\/\/localhost\/wp.dev\/gravityformsapi\/' + route + '?api_key=' + publicKey + '&amp;signature=' + sig + '&amp;expires=' + future_unixtime;\r\n        url += '&amp;paging&#x5B;page_size]=' + page_size;\r\n\r\n\t$.get(url, function(data, textStatus)\r\n\t{\r\n\t\t\/\/get the data from the api\r\n\t\tif ( data.status != 200 || ( typeof( data ) != 'object' ) ) {\r\n\t\t\t\/\/http request failed\r\n\t\t\tdocument.write( 'There was an error attempting to access the API - ' + data.status + ': ' + data.response );\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tresponse    = data.response;\r\n\t\tentries     = response.entries; \/\/entries is a collection of Entry objects\r\n\t\ttotal_count = response.total_count;\r\n\t});\r\n\r\n&lt;\/script&gt;\r\n<\/pre>\n<h4 id=\"h-retrieve-a-single-entry\">Retrieve a single entry<\/h4>\n<p>This example may be viewed in the <a href=\"https:\/\/docs.gravityforms.com\/web-api#retrieve_single_entry\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<h4 id=\"h-retrieve-specific-fields-for-a-single-entry\">Retrieve specific fields for a single entry<\/h4>\n<p>This example may be viewed in the <a href=\"https:\/\/docs.gravityforms.com\/web-api#retrieve_entry_specific_fields\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<h4 id=\"h-retrieve-specific-fields-for-multiple-entries\">Retrieve specific fields for multiple entries<\/h4>\n<p>This example may be viewed in the <a href=\"https:\/\/docs.gravityforms.com\/web-api#retrieve_entry_specific_fields\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<h3 id=\"h-create-entries\">Create Entries<\/h3>\n<h4 id=\"h-create-entries-0\">Create Entries<\/h4>\n<p>This example may be viewed in the <a href=\"https:\/\/docs.gravityforms.com\/web-api#post_entries\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<h4 id=\"h-create-entry-for-a-specific-form\">Create Entry for a Specific Form<\/h4>\n<p>This example may be viewed in the <a href=\"https:\/\/docs.gravityforms.com\/web-api#post_entry_for_form\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<h3 id=\"h-update-entries\">Update Entries<\/h3>\n<h4 id=\"h-update-single-entry-create-entry-array-manually\">Update Single Entry (Create Entry Array Manually)<\/h4>\n<p>The example below updates entry id 157.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\npublic static function calculate_signature( $string, $private_key ) {\r\n  $hash = hash_hmac( 'sha1', $string, $private_key, true );\r\n  $sig = rawurlencode( base64_encode( $hash ) );\r\n  return $sig;\r\n}\r\n\r\n$base_url = 'http:\/\/localhost\/wpdev\/gravityformsapi\/';\r\n$api_key = 'your_api_key';\r\n$private_key = 'your_private_key';\r\n$method = 'PUT';\r\n$route = 'entries\/157';\r\n$expires = strtotime( '+60 mins' );\r\n$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, $method, $route, $expires );\r\n$sig = self::calculate_signature( $string_to_sign, $private_key );\r\n\r\n$url = $base_url . $route . '?api_key=' . $api_key . '&amp;signature=' . $sig . '&amp;expires=' . $expires;\r\n\r\n$entry = array(\r\n             'form_id'      =&gt; '28',\r\n             'date_created' =&gt; '2015-06-15 22:43:23',\r\n             'is_starred'   =&gt; 0,\r\n             'is_read'      =&gt; 1,\r\n             'ip'           =&gt; '::1',\r\n             'source_url'   =&gt; 'http:\/\/localhost\/wpdev\/?gf_page=preview&amp;id=28',\r\n             'currency'     =&gt; 'USD',\r\n             'created_by'   =&gt; 1,\r\n             'user_agent'   =&gt; 'Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko\/20100101 Firefox\/38.0',\r\n             'status'       =&gt; 'active',\r\n             '1.3'          =&gt; 'Eric',\r\n             '1.6'          =&gt; 'Draven',\r\n             '2'            =&gt; 'brandonlee',\r\n             '3'            =&gt; 'The Crows',\r\n\t );\r\n\r\n$entry_json = json_encode( $entry );\r\n\r\n$response = wp_remote_request( $url, array( 'method' =&gt; $method, 'body' =&gt; $entry_json ) );\r\n\r\nif ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){\r\n\t\/\/http request failed\r\n\techo 'There was an error attempting to access the API.';\r\n\tdie();\r\n}\r\n\r\n$body_json = wp_remote_retrieve_body( $response );\r\n\/\/results are in the &quot;body&quot; and are json encoded, decode them and put into an array\r\n$body = json_decode( $body_json, true );\r\n\r\n$data\t     = $body&#x5B;'response'];\r\n$status_code = $body&#x5B;'status'];\r\n\r\nif ( $status_code &lt;= 202 ){\r\n\t\/\/entries retrieved successfully\r\n\t$status  = $status_code;\r\n}\r\nelse {\r\n\t\/\/entry update failed, get error information\r\n\t$error_code    = $data&#x5B;'code'];\r\n\t$error_message = $data&#x5B;'message'];\r\n\t$error_data    = isset( $data&#x5B;'data'] ) ? $data&#x5B;'data'] : '';\r\n\t$status        = $status_code . ' - ' . $error_code . ' ' . $error_message . ' ' . $error_data;\r\n}\r\n\/\/display results in a simple page\r\n?&gt;\r\n&lt;html&gt;\r\n&lt;body&gt;\r\n&lt;form&gt;\r\n\t&lt;p&gt;Results&lt;\/p&gt;\r\n\t&lt;div&gt;Status Code: &lt;?php echo $status ?&gt;&lt;\/div&gt;\r\n\t&lt;div&gt;JSON Response:&lt;br\/&gt;&lt;textarea style=&quot;vertical-align: top&quot; cols=&quot;125&quot; rows=&quot;10&quot;&gt; &lt;?php echo $response&#x5B;'body']; ?&gt;&lt;\/textarea&gt;&lt;\/div&gt;\r\n&lt;\/form&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;script src=&quot;https:\/\/code.jquery.com\/jquery-1.10.2.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/rollups\/hmac-sha1.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/components\/enc-base64-min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\nfunction CalculateSig(stringToSign, privateKey){\r\n\t\/\/calculate the signature needed for authentication\r\n\tvar hash = CryptoJS.HmacSHA1(stringToSign, privateKey);\r\n\tvar base64 = hash.toString(CryptoJS.enc.Base64);\r\n\treturn encodeURIComponent(base64);\r\n}\r\n\r\n\/\/set variables\r\nvar d = new Date;\r\nvar expiration = 3600; \/\/ 1 hour,\r\nvar unixtime = parseInt(d.getTime() \/ 1000);\r\nvar future_unixtime = unixtime + expiration;\r\nvar publicKey = &quot;your_public_key&quot;;\r\nvar privateKey = &quot;your_private_key&quot;;\r\nvar method = &quot;PUT&quot;;\r\nvar route = &quot;entries\/157&quot;;\r\n\r\nstringToSign = publicKey + &quot;:&quot; + method + &quot;:&quot; + route + &quot;:&quot; + future_unixtime;\r\nsig = CalculateSig(stringToSign, privateKey);\r\nvar url = 'http:\/\/localhost\/wp.dev\/gravityformsapi\/' + route + '?api_key=' + publicKey + '&amp;signature=' + sig + '&amp;expires=' + future_unixtime;\r\n\r\nvar update_entry = {\r\n\tform_id     : '28',\r\n\tdate_created: '2016-07-29 21:38:23',\r\n\tis_starred  : 0,\r\n\tis_read     : 1,\r\n\tip          : '::1',\r\n\tsource_url  : 'http:\/\/localhost\/wpdev\/?gf_page=preview&amp;id=1',\r\n\tcurrency    : 'USD',\r\n\tcreated_by  : 1,\r\n\tuser_agent  : 'Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko\/20100101 Firefox\/38.0',\r\n\tstatus      : 'active',\r\n\t1.3         : 'Testing',\r\n\t1.6         : 'Tester',\r\n\t3           : 'The Crowsxxxxxxxxxxxxx'\r\n} ;\r\n\r\nentry_json = JSON.stringify( update_entry );\r\n\r\n$.ajax({\r\n\turl: url,\r\n\ttype: 'PUT',\r\n\tdata: entry_json,\r\n\tcontentType:'application\/json',\r\n\tsuccess: function(result) {alert('success');},\r\n\terror: function(result, textStatus, errorThrown){alert('error ' + errorThrown);}\r\n});\r\n\r\n&lt;\/script&gt;\r\n<\/pre>\n<h4 id=\"h-update-single-entry-create-entry-array-using-existing-database-record\">Update Single Entry (Create Entry Array Using Existing Database Record)<\/h4>\n<p>This example may be viewed in the <a href=\"https:\/\/docs.gravityforms.com\/web-api#put_entry\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<h4 id=\"h-update-entries-create-entries-array-manually\">Update Entries (Create Entries Array Manually)<\/h4>\n<p>This example may be viewed in the <a href=\"https:\/\/docs.gravityforms.com\/web-api#put_entries\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<h4 id=\"h-update-entries-create-entries-array-using-existing-database-records\">Update Entries (Create Entries Array Using Existing Database Records)<\/h4>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\npublic static function calculate_signature( $string, $private_key ) {\r\n  $hash = hash_hmac( 'sha1', $string, $private_key, true );\r\n  $sig = rawurlencode( base64_encode( $hash ) );\r\n  return $sig;\r\n}\r\n\r\n$base_url = 'http:\/\/localhost\/wpdev\/gravityformsapi\/';\r\n$api_key = 'your_api_key';\r\n$private_key = 'your_private_key';\r\n$method = 'PUT';\r\n$route = 'entries';\r\n$expires = strtotime( '+60 mins' );\r\n$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, $method, $route, $expires );\r\n$sig = self::calculate_signature( $string_to_sign, $private_key );\r\n\r\n$url = $base_url . $route . '?api_key=' . $api_key . '&amp;signature=' . $sig . '&amp;expires=' . $expires;\r\n\r\n\/\/get entry object for id 156 and modify\r\n$entry1 = GFAPI::get_entry( 156 );\r\n$entry1&#x5B;'is_starred'] = 1;\r\n$entry1&#x5B;'3'] = 'Newt';\r\n\/\/add entry to entries array\r\n$entries&#x5B;] = $entry1;\r\n\r\n\/\/get entry object for id 157 and modify\r\n$entry2 = GFAPI::get_entry( 157 );\r\n$entry2&#x5B;'2'] = 'eric draven';\r\n$entry2&#x5B;'is_read'] = 0;\r\n\/\/add entry to entries array\r\n$entries&#x5B;] = $entry2;\r\n\r\n\/\/json encode array\r\n$entry_json = json_encode( $entries );\r\n\r\n$response = wp_remote_request( $url, array( 'method' =&gt; $method, 'body' =&gt; $entry_json ) );\r\n\r\nif ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){\r\n    \/\/http request failed\r\n    echo 'There was an error attempting to access the API.';\r\n    die();\r\n}\r\n\r\n$body_json = wp_remote_retrieve_body( $response );\r\n\/\/results are in the &quot;body&quot; and are json encoded, decode them and put into an array\r\n$body = json_decode( $body_json, true );\r\n\r\n$data        = $body&#x5B;'response'];\r\n$status_code = $body&#x5B;'status'];\r\n\r\nif ( $status_code &lt;= 202 ){\r\n    \/\/entries retrieved successfully\r\n    $status  = $status_code;\r\n}\r\nelse {\r\n    \/\/entry update failed, get error information, error could just be a string\r\n    if ( is_array( $data )){\r\n        $error_code    = $data&#x5B;'code'];\r\n        $error_message = $data&#x5B;'message'];\r\n        $error_data    = isset( $data&#x5B;'data'] ) ? $data&#x5B;'data'] : '';\r\n        $status        = $status_code . ' - ' . $error_code . ' ' . $error_message . ' ' . $error_data;\r\n    }\r\n    else{\r\n        $status = $data;\r\n    }\r\n}\r\n\/\/display results in a simple page\r\n?&gt;\r\n&lt;html&gt;\r\n&lt;body&gt;\r\n&lt;form&gt;\r\n    &lt;p&gt;Results&lt;\/p&gt;\r\n    &lt;div&gt;Status Code: &lt;?php echo $status ?&gt;&lt;\/div&gt;\r\n    &lt;div&gt;JSON Response:&lt;br\/&gt;&lt;textarea style=&quot;vertical-align: top&quot; cols=&quot;125&quot; rows=&quot;10&quot;&gt; &lt;?php echo $response&#x5B;'body']; ?&gt;&lt;\/textarea&gt;&lt;\/div&gt;\r\n&lt;\/form&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;script src=&quot;https:\/\/code.jquery.com\/jquery-1.10.2.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/rollups\/hmac-sha1.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/components\/enc-base64-min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\nfunction CalculateSig(stringToSign, privateKey){\r\n\t\/\/calculate the signature needed for authentication\r\n\tvar hash = CryptoJS.HmacSHA1(stringToSign, privateKey);\r\n\tvar base64 = hash.toString(CryptoJS.enc.Base64);\r\n\treturn encodeURIComponent(base64);\r\n}\r\n\r\n\/\/set variables\r\nvar d = new Date;\r\nvar expiration = 3600; \/\/ 1 hour,\r\nvar unixtime = parseInt(d.getTime() \/ 1000);\r\nvar future_unixtime = unixtime + expiration;\r\nvar\tpublicKey = &quot;your_public_key&quot;;\r\nvar\tprivateKey = &quot;your_private_key&quot;;\r\n\r\n\/\/create signature and url for putting entries\r\nstringToSign = publicKey + &quot;:PUT:entries:&quot; + future_unixtime;\r\nsig = CalculateSig(stringToSign, privateKey);\r\nvar put_url = 'http:\/\/localhost\/wp.dev\/gravityformsapi\/entries?api_key=' + publicKey + '&amp;signature=' + sig + '&amp;expires=' + future_unixtime;\r\n\r\n\/\/create signature and url for first entry\r\nstringToSign = publicKey + &quot;:GET:entries\/7:&quot; + future_unixtime;\r\nsig = CalculateSig(stringToSign, privateKey);\r\nvar get_url1 = 'http:\/\/localhost\/wp.dev\/gravityformsapi\/entries\/7?api_key=' + publicKey + '&amp;signature=' + sig + '&amp;expires=' + future_unixtime;\r\n\r\n\/\/get signature and url for second entry\r\nstringToSign = publicKey + &quot;:GET:entries\/16:&quot; + future_unixtime;\r\nsig = CalculateSig(stringToSign, privateKey);\r\nvar get_url2 = 'http:\/\/localhost\/wp.dev\/gravityformsapi\/entries\/16?api_key=' + publicKey + '&amp;signature=' + sig + '&amp;expires=' + future_unixtime;\r\n\r\n$.get(get_url1, function(data, textStatus)\r\n{\r\n\t\/\/get the data from the api for the first entry\r\n\tif ( data.status != 200 || ( typeof( data ) != 'object' ) ) {\r\n\t\t\/\/http request failed\r\n\t\tdocument.write( 'There was an error attempting to access the API - ' + data.status + ': ' + data.response );\r\n\t\treturn;\r\n\t}\r\n\tentry1 = data.response;\r\n\tentry1&#x5B;'is_starred'] = 1;\r\n\tentry1&#x5B;'2.3'] = 'Newt';\r\n\tentry1&#x5B;'2.6'] = 'Alien';\r\n\t$.get(get_url2, function(data, textStatus){\r\n                \/\/get the data for the second entry\r\n\t\tentry2 = data.response;\r\n\t\tentry2&#x5B;'is_read'] = 0;\r\n\t\tentry2&#x5B;'1'] = 'first field data';\r\n\t\tentry2&#x5B;'2.3'] = 'New';\r\n\t\tentry2&#x5B;'2.6'] = 'Name';\r\n\r\n\t\tvar entries = Array();\r\n\t\tentries&#x5B;0] = entry1;\r\n\t\tentries&#x5B;1] = entry2;\r\n\t\tentry_json = JSON.stringify(entries);\r\n\r\n                \/\/update the entries\r\n\t\t$.ajax({\r\n\t\t\turl: put_url,\r\n\t\t\ttype: 'PUT',\r\n\t\t\tdata: entry_json,\r\n\t\t\tcontentType:'application\/json',\r\n\t\t\tsuccess: function(result) {alert('success');},\r\n\t\t\terror: function(result, textStatus, errorThrown){alert('error ' + errorThrown);}\r\n\t\t});\r\n\t});\r\n\r\n});\r\n&lt;\/script&gt;\r\n<\/pre>\n<h3 id=\"h-delete-entries\">Delete Entries<\/h3>\n<h4 id=\"h-delete-multiple-entries\">Delete Multiple Entries<\/h4>\n<p>This example may be viewed in the <a href=\"https:\/\/docs.gravityforms.com\/web-api#delete_entries\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<h2 id=\"h-forms\">Forms<\/h2>\n<h3 id=\"h-retrieve-forms\">Retrieve Forms<\/h3>\n<h4 id=\"h-retrieve-all-active-forms\">Retrieve all active forms<\/h4>\n<p>This example retrieves all active forms and displays them in a list.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nfunction calculate_signature( $string, $private_key ) {\r\n\t$hash = hash_hmac( 'sha1', $string, $private_key, true );\r\n\t$sig = rawurlencode( base64_encode( $hash ) );\r\n\treturn $sig;\r\n}\r\n\r\n\/\/set API keys\r\n$api_key = 'your_api_key';\r\n$private_key = 'your_private_key';\r\n\r\n\/\/set route\r\n$route = 'forms';\r\n\r\n\/\/creating request URL\r\n$expires = strtotime( '+60 mins' );\r\n$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'GET', $route, $expires );\r\n$sig = self::calculate_signature( $string_to_sign, $private_key );\r\n$url = 'http:\/\/localhost\/wpdev\/gravityformsapi\/' . $route . '?api_key=' . $api_key . '&amp;signature=' . $sig . '&amp;expires=' . $expires;\r\n\r\n\/\/retrieve data\r\n$response = wp_remote_request( $url, array( 'method' =&gt; 'GET' ) );\r\nif ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){\r\n\t\/\/http request failed\r\n\tdie( 'There was an error attempting to access the API.' );\r\n}\r\n\r\n\/\/result is in the response &quot;body&quot; and is json encoded.\r\n$body = json_decode( wp_remote_retrieve_body( $response ), true );\r\n\r\nif( $body&#x5B;'status'] &gt; 202 ){\r\n\tdie( &quot;Could not retrieve forms.&quot; );\r\n}\r\n\r\n\/\/forms retrieved successfully\r\n$forms = $body&#x5B;'response'];\r\n\r\n\/\/display results in a simple page\r\n?&gt;\r\n&lt;html&gt;\r\n&lt;body&gt;\r\n&lt;form&gt;\r\n\t&lt;p&gt;Forms&lt;\/p&gt;\r\n\t&lt;div&gt;\r\n\t\t&lt;?php\r\n\t\tif ( $forms ) {\r\n\t\t\techo '&lt;table border=&quot;1&quot;&gt;&lt;th&gt;Form ID&lt;\/th&gt;&lt;th&gt;Form Title&lt;\/th&gt;&lt;th&gt;Entry Count&lt;\/th&gt;';\r\n\t\t\tforeach ( $forms as $form ) {\r\n\t\t\t\techo '&lt;tr&gt;&lt;td&gt;' . $form&#x5B;'id'] . '&lt;\/td&gt;&lt;td&gt;' . $form&#x5B;'title'] . '&lt;\/td&gt;&lt;td&gt;' . $form&#x5B;'entries'] . '&lt;\/td&gt;&lt;\/tr&gt;';\r\n\t\t\t}\r\n\t\t\techo '&lt;\/table&gt;';\r\n\t\t}\r\n\t\t?&gt;\r\n\t&lt;\/div&gt;\r\n\t&lt;br\/&gt;\r\n\t&lt;div&gt;JSON Response:&lt;br\/&gt;&lt;textarea style=&quot;vertical-align: top&quot; cols=&quot;125&quot; rows=&quot;10&quot;&gt; &lt;?php echo $response&#x5B;'body']; ?&gt;&lt;\/textarea&gt;&lt;\/div&gt;\r\n&lt;\/form&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;script src=&quot;https:\/\/code.jquery.com\/jquery-1.10.2.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/rollups\/hmac-sha1.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/components\/enc-base64-min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\nfunction CalculateSig(stringToSign, privateKey){\r\n\t\/\/calculate the signature needed for authentication\r\n\tvar hash = CryptoJS.HmacSHA1(stringToSign, privateKey);\r\n\tvar base64 = hash.toString(CryptoJS.enc.Base64);\r\n\treturn encodeURIComponent(base64);\r\n}\r\n\r\n\/\/set variables\r\nvar d = new Date;\r\nvar expiration = 3600; \/\/ 1 hour,\r\nvar unixtime = parseInt(d.getTime() \/ 1000);\r\nvar future_unixtime = unixtime + expiration;\r\nvar\tpublicKey = &quot;your_public_key&quot;;\r\nvar\tprivateKey = &quot;your_private_key&quot;;\r\nvar\tmethod = &quot;GET&quot;;\r\nvar route = &quot;forms&quot;;\r\n\r\nstringToSign = publicKey + &quot;:&quot; + method + &quot;:&quot; + route + &quot;:&quot; + future_unixtime;\r\nsig = CalculateSig(stringToSign, privateKey);\r\nvar url = 'http:\/\/localhost\/wp.dev\/gravityformsapi\/' + route + '?api_key=' + publicKey + '&amp;signature=' + sig + '&amp;expires=' + future_unixtime;\r\n\r\n$.get(url, function(data, textStatus)\r\n{\r\n\t\/\/get the data from the api\r\n\tif ( data.status != 200 || ( typeof( data ) != 'object' ) ) {\r\n\t\t\/\/http request failed\r\n\t\tdocument.write( 'There was an error attempting to access the API - ' + data.status + ': ' + data.response );\r\n\t\treturn;\r\n\t}\r\n\tforms \t\t  = data.response;\r\n\tdocument.write('&lt;p&gt;Results&lt;\/p&gt;');\r\n\tdocument.write('&lt;table border=&quot;1&quot;&gt;&lt;th&gt;Form ID&lt;\/th&gt;&lt;th&gt;Form Title&lt;\/th&gt;&lt;th&gt;Entry Count&lt;\/th&gt;');\r\n\tfor (var form in forms) {\r\n\t\tdocument.write('&lt;tr&gt;&lt;td&gt;' + forms&#x5B;form]&#x5B;'id'] + '&lt;\/td&gt;&lt;td&gt;' + forms&#x5B;form]&#x5B;'title'] + '&lt;\/td&gt;&lt;td&gt;' + forms&#x5B;form]&#x5B;'entries'] + '&lt;\/td&gt;&lt;\/tr&gt;');\r\n\t}\r\n\tdocument.write(&quot;&lt;\/table&gt;&quot;);\r\n});\r\n&lt;\/script&gt;\r\n<\/pre>\n<h4 id=\"h-retrieve-a-single-form\">Retrieve a single form<\/h4>\n<p>This example retrieves a single form and displays the details, along with field information.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nfunction calculate_signature( $string, $private_key ) {\r\n\t$hash = hash_hmac( 'sha1', $string, $private_key, true );\r\n\t$sig = rawurlencode( base64_encode( $hash ) );\r\n\treturn $sig;\r\n}\r\n\r\n\/\/set API keys\r\n$api_key = 'your_api_key';\r\n$private_key = 'your_private_key';\r\n\r\n\/\/set route\r\n$route = 'forms\/67';\r\n\r\n\/\/creating request URL\r\n$expires = strtotime( '+60 mins' );\r\n$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'GET', $route, $expires );\r\n$sig = calculate_signature( $string_to_sign, $private_key );\r\n$url = 'http:\/\/localhost\/wp\/gravityformsapi\/' . $route . '?api_key=' . $api_key . '&amp;signature=' . $sig . '&amp;expires=' . $expires;\r\n\r\n\/\/retrieve data\r\n$response = wp_remote_request( $url, array( 'method' =&gt; 'GET' ) );\r\nif ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){\r\n\t\/\/http request failed\r\n\tdie( 'There was an error attempting to access the API.' );\r\n}\r\n\r\n\/\/result is in the response &quot;body&quot; and is json encoded.\r\n$body = json_decode( wp_remote_retrieve_body( $response ), true );\r\n\r\nif( $body&#x5B;'status'] &gt; 202 ){\r\n\tdie( &quot;Could not retrieve forms.&quot; );\r\n}\r\n\r\n\/\/forms retrieved successfully\r\n$form = $body&#x5B;'response'];\r\n\r\n\/\/display results in a simple page\r\n?&gt;\r\n&lt;html&gt;\r\n&lt;body&gt;\r\n&lt;form&gt;\r\n\t&lt;p&gt;Forms&lt;\/p&gt;\r\n\t&lt;div&gt;\r\n\t\t&lt;?php\r\n\t\tif ( $form ) {\r\n\t\t\techo '&lt;table border=&quot;1&quot;&gt;&lt;th&gt;Form ID&lt;\/th&gt;&lt;th&gt;Form Title&lt;\/th&gt;&lt;th&gt;Field Count&lt;\/th&gt;';\r\n\t\t\t\/\/foreach ( $forms as $form ) {\r\n\t\t\t\t$fields = $form&#x5B;'fields'];\r\n\t\t\t\techo '&lt;tr&gt;&lt;td&gt;' . $form&#x5B;'id'] . '&lt;\/td&gt;&lt;td&gt;' . $form&#x5B;'title'] . '&lt;\/td&gt;&lt;td&gt;' . count( $fields ) . '&lt;\/td&gt;&lt;\/tr&gt;';\r\n\t\t\t\tif ( $fields ){\r\n\t\t\t\t\techo '&lt;tr&gt;&lt;td colspan=&quot;3&quot;&gt;&lt;table border=&quot;1&quot;&gt;&lt;th&gt;Field ID&lt;\/th&gt;&lt;th&gt;Field Label&lt;\/th&gt;&lt;th&gt;Field Type&lt;\/th&gt;';\r\n\t\t\t\t\tforeach ( $fields as $field ){\r\n\t\t\t\t\t\techo '&lt;tr&gt;&lt;td&gt;' . $field&#x5B;'id'] . '&lt;\/td&gt;&lt;td&gt;' . GFCommon::get_label( $field ) . '&lt;\/td&gt;&lt;td&gt;' . $field&#x5B;'type'] . '&lt;\/td&gt;&lt;\/tr&gt;';\r\n\t\t\t\t\t}\r\n\t\t\t\t\techo '&lt;\/table&gt;&lt;\/td&gt;&lt;\/tr&gt;';\r\n\t\t\t\t}\r\n\t\t\t\techo '&lt;tr&gt;&lt;td colspan=&quot;3&quot;&gt;&amp;nbsp;&lt;\/td&gt;&lt;\/tr&gt;';\r\n\t\t\t\/\/}\r\n\t\t\techo '&lt;\/table&gt;';\r\n\t\t}\r\n\t\t?&gt;\r\n\t&lt;\/div&gt;\r\n\t&lt;br\/&gt;\r\n\t&lt;div&gt;JSON Response:&lt;br\/&gt;&lt;textarea style=&quot;vertical-align: top&quot; cols=&quot;125&quot; rows=&quot;10&quot;&gt; &lt;?php echo $response&#x5B;'body']; ?&gt;&lt;\/textarea&gt;&lt;\/div&gt;\r\n&lt;\/form&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;script src=&quot;https:\/\/code.jquery.com\/jquery-1.10.2.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/rollups\/hmac-sha1.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/components\/enc-base64-min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\nfunction CalculateSig(stringToSign, privateKey){\r\n\t\/\/calculate the signature needed for authentication\r\n\tvar hash = CryptoJS.HmacSHA1(stringToSign, privateKey);\r\n\tvar base64 = hash.toString(CryptoJS.enc.Base64);\r\n\treturn encodeURIComponent(base64);\r\n}\r\n\r\n\/\/set variables\r\nvar d = new Date;\r\nvar expiration = 3600; \/\/ 1 hour,\r\nvar unixtime = parseInt(d.getTime() \/ 1000);\r\nvar future_unixtime = unixtime + expiration;\r\nvar\tpublicKey = &quot;your_public_key&quot;;\r\nvar\tprivateKey = &quot;your_private_key&quot;;\r\nvar\tmethod = &quot;GET&quot;;\r\nvar route = &quot;forms\/1&quot;;\r\n\r\nstringToSign = publicKey + &quot;:&quot; + method + &quot;:&quot; + route + &quot;:&quot; + future_unixtime;\r\nsig = CalculateSig(stringToSign, privateKey);\r\nvar url = 'http:\/\/localhost\/wp.dev\/gravityformsapi\/' + route + '?api_key=' + publicKey + '&amp;signature=' + sig + '&amp;expires=' + future_unixtime;\r\n\r\n$.get(url, function(data, textStatus)\r\n{\r\n\t\/\/get the data from the api\r\n\tif ( data.status != 200 || ( typeof( data ) != 'object' ) ) {\r\n\t\t\/\/http request failed\r\n\t\tdocument.write( 'There was an error attempting to access the API - ' + data.status + ': ' + data.response );\r\n\t\treturn;\r\n\t}\r\n\tform = data.response;\r\n\tfields = form&#x5B;'fields'];\r\n\tfield_count=fields&#x5B;'length'];\r\n\tdocument.write('&lt;p&gt;Results&lt;\/p&gt;');\r\n\tdocument.write('&lt;table border=&quot;1&quot;&gt;&lt;th&gt;Form ID&lt;\/th&gt;&lt;th&gt;Form Title&lt;\/th&gt;&lt;th&gt;Field Count&lt;\/th&gt;');\r\n\tdocument.write('&lt;tr&gt;&lt;td&gt;' + form&#x5B;'id'] + '&lt;\/td&gt;&lt;td&gt;' + form&#x5B;'title'] + '&lt;\/td&gt;&lt;td&gt;' + field_count + '&lt;\/td&gt;&lt;\/tr&gt;');\r\n\tif ( fields ){\r\n\t\tdocument.write('&lt;tr&gt;&lt;td colspan=&quot;3&quot;&gt;&lt;table border=&quot;1&quot;&gt;&lt;th&gt;Field ID&lt;\/th&gt;&lt;th&gt;Field Label&lt;\/th&gt;&lt;th&gt;Field Type&lt;\/th&gt;');\r\n\t\tfor ( var i=0;i&lt;field_count;i++ ){\r\n\t\t\tdocument.write('&lt;tr&gt;&lt;td&gt;' + fields&#x5B;i]&#x5B;'id'] + '&lt;\/td&gt;&lt;td&gt;' + fields&#x5B;i]&#x5B;'label'] + '&lt;\/td&gt;&lt;td&gt;' + fields&#x5B;i]&#x5B;'type'] + '&lt;\/td&gt;&lt;\/tr&gt;');\r\n\t\t}\r\n\t\tdocument.write('&lt;\/table&gt;&lt;\/td&gt;&lt;\/tr&gt;');\r\n\t}\r\n\tdocument.write('&lt;tr&gt;&lt;td colspan=&quot;3&quot;&gt;&amp;nbsp;&lt;\/td&gt;&lt;\/tr&gt;');\r\n\r\n\tdocument.write(&quot;&lt;\/table&gt;&quot;);\r\n});\r\n&lt;\/script&gt;\r\n<\/pre>\n<h4 id=\"h-retrieve-multiple-forms\">Retrieve multiple forms<\/h4>\n<p>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.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nfunction calculate_signature( $string, $private_key ) {\r\n\t$hash = hash_hmac( 'sha1', $string, $private_key, true );\r\n\t$sig = rawurlencode( base64_encode( $hash ) );\r\n\treturn $sig;\r\n}\r\n\r\n\/\/set API keys\r\n$api_key = 'your_api_key';\r\n$private_key = 'your_private_key';\r\n\r\n\/\/set route\r\n$route = 'forms\/67;68;1';\r\n\r\n\/\/creating request URL\r\n$expires = strtotime( '+60 mins' );\r\n$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'GET', $route, $expires );\r\n$sig = calculate_signature( $string_to_sign, $private_key );\r\n$url = 'http:\/\/localhost\/wpdev\/gravityformsapi\/' . $route . '?api_key=' . $api_key . '&amp;signature=' . $sig . '&amp;expires=' . $expires;\r\n\r\n\/\/retrieve data\r\n$response = wp_remote_request( $url, array( 'method' =&gt; 'GET' ) );\r\nif ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){\r\n\t\/\/http request failed\r\n\tdie( 'There was an error attempting to access the API.' );\r\n}\r\n\r\n\/\/result is in the response &quot;body&quot; and is json encoded.\r\n$body = json_decode( wp_remote_retrieve_body( $response ), true );\r\n\r\nif( $body&#x5B;'status'] &gt; 202 ){\r\n\tdie( &quot;Could not retrieve forms.&quot; );\r\n}\r\n\r\n\/\/forms retrieved successfully\r\n$forms = $body&#x5B;'response'];\r\n\r\n\/\/display results in a simple page\r\n?&gt;\r\n&lt;html&gt;\r\n&lt;body&gt;\r\n&lt;form&gt;\r\n\t&lt;p&gt;Forms&lt;\/p&gt;\r\n\t&lt;div&gt;\r\n\t\t&lt;?php\r\n\t\tif ( $forms ) {\r\n\t\t\techo '&lt;table border=&quot;1&quot;&gt;&lt;th&gt;Form ID&lt;\/th&gt;&lt;th&gt;Form Title&lt;\/th&gt;&lt;th&gt;Field Count&lt;\/th&gt;';\r\n\t\t\tforeach ( $forms as $form_id =&gt; $form ) {\r\n\t\t\t\tif ( ! $form ){\r\n\t\t\t\t\t\/\/if a form is not found, false is returned\r\n\t\t\t\t\techo '&lt;tr&gt;&lt;td colspan=&quot;3&quot;&gt;Form ID ' . $form_id . ' could not be found.&lt;\/td&gt;&lt;\/tr&gt;';\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\t$fields = $form&#x5B;'fields'];\r\n\t\t\t\t\techo '&lt;tr&gt;&lt;td&gt;' . $form&#x5B;'id'] . '&lt;\/td&gt;&lt;td&gt;' . $form&#x5B;'title'] . '&lt;\/td&gt;&lt;td&gt;' . count( $fields ) . '&lt;\/td&gt;&lt;\/tr&gt;';\r\n\t\t\t\t\tif ( $fields ){\r\n\t\t\t\t\t\t\/\/display basic field info\r\n\t\t\t\t\t\techo '&lt;tr&gt;&lt;td colspan=&quot;3&quot;&gt;&lt;table border=&quot;1&quot;&gt;&lt;th&gt;Field ID&lt;\/th&gt;&lt;th&gt;Field Label&lt;\/th&gt;&lt;th&gt;Field Type&lt;\/th&gt;';\r\n\t\t\t\t\t\tforeach ( $fields as $field ){\r\n\t\t\t\t\t\t\techo '&lt;tr&gt;&lt;td&gt;' . $field&#x5B;'id'] . '&lt;\/td&gt;&lt;td&gt;' . GFCommon::get_label( $field ) . '&lt;\/td&gt;&lt;td&gt;' . $field&#x5B;'type'] . '&lt;\/td&gt;&lt;\/tr&gt;';\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\techo '&lt;\/table&gt;&lt;\/td&gt;&lt;\/tr&gt;';\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\techo '&lt;tr&gt;&lt;td colspan=&quot;3&quot;&gt;&amp;nbsp;&lt;\/td&gt;&lt;\/tr&gt;';\r\n\t\t\t}\r\n\t\t\techo '&lt;\/table&gt;';\r\n\t\t}\r\n\t\t?&gt;\r\n\t&lt;\/div&gt;\r\n\t&lt;br\/&gt;\r\n\t&lt;div&gt;JSON Response:&lt;br\/&gt;&lt;textarea style=&quot;vertical-align: top&quot; cols=&quot;125&quot; rows=&quot;10&quot;&gt; &lt;?php echo $response&#x5B;'body']; ?&gt;&lt;\/textarea&gt;&lt;\/div&gt;\r\n&lt;\/form&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;script src=&quot;https:\/\/code.jquery.com\/jquery-1.10.2.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/rollups\/hmac-sha1.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/components\/enc-base64-min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\nfunction CalculateSig(stringToSign, privateKey){\r\n\t\/\/calculate the signature needed for authentication\r\n\tvar hash = CryptoJS.HmacSHA1(stringToSign, privateKey);\r\n\tvar base64 = hash.toString(CryptoJS.enc.Base64);\r\n\treturn encodeURIComponent(base64);\r\n}\r\n\r\n\/\/set variables\r\nvar d = new Date;\r\nvar expiration = 3600; \/\/ 1 hour,\r\nvar unixtime = parseInt(d.getTime() \/ 1000);\r\nvar future_unixtime = unixtime + expiration;\r\nvar\tpublicKey = &quot;your_public_key&quot;;\r\nvar\tprivateKey = &quot;your_private_key&quot;;\r\nvar\tmethod = &quot;GET&quot;;\r\nvar route = &quot;forms\/1;9;2;3;4&quot;;\r\n\r\nstringToSign = publicKey + &quot;:&quot; + method + &quot;:&quot; + route + &quot;:&quot; + future_unixtime;\r\nsig = CalculateSig(stringToSign, privateKey);\r\nvar url = 'http:\/\/localhost\/wp.dev\/gravityformsapi\/' + route + '?api_key=' + publicKey + '&amp;signature=' + sig + '&amp;expires=' + future_unixtime;\r\n\r\n$.get(url, function(data, textStatus)\r\n{\r\n\t\/\/get the data from the api\r\n\tif ( data.status != 200 || ( typeof( data ) != 'object' ) ) {\r\n\t\t\/\/http request failed\r\n\t\tdocument.write( 'There was an error attempting to access the API - ' + data.status + ': ' + data.response );\r\n\t\treturn;\r\n\t}\r\n\tforms = data.response;\r\n\tif ( forms ){\r\n\t\tdocument.write('&lt;p&gt;Results&lt;\/p&gt;');\r\n\t\tdocument.write('&lt;table border=&quot;1&quot;&gt;&lt;th&gt;Form ID&lt;\/th&gt;&lt;th&gt;Form Title&lt;\/th&gt;&lt;th&gt;Field Count&lt;\/th&gt;');\r\n\t\t\/\/loop through form ids returned\r\n\t\tfor (var id in forms){\r\n\t\t\t\/\/if a form is not found, false is returned\r\n\t\t\tif ( ! forms&#x5B;id]){\r\n\t\t\t\tdocument.write('&lt;tr&gt;&lt;td colspan=&quot;3&quot;&gt;Form ID ' + id + ' could not be found.&lt;\/td&gt;&lt;\/tr&gt;');\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tform = forms&#x5B;id]; \/\/get single form object using id\r\n\t\t\t\tfields = form&#x5B;'fields'];\r\n\t\t\t\tfield_count=fields&#x5B;'length'];\r\n\t\t\t\tdocument.write('&lt;tr&gt;&lt;td&gt;' + form&#x5B;'id'] + '&lt;\/td&gt;&lt;td&gt;' + form&#x5B;'title'] + '&lt;\/td&gt;&lt;td&gt;' + field_count + '&lt;\/td&gt;&lt;\/tr&gt;');\r\n\r\n\t\t\t\tif ( fields ){\r\n\t\t\t\t\tdocument.write('&lt;tr&gt;&lt;td colspan=&quot;3&quot;&gt;&lt;table border=&quot;1&quot;&gt;&lt;th&gt;Field ID&lt;\/th&gt;&lt;th&gt;Field Label&lt;\/th&gt;&lt;th&gt;Field Type&lt;\/th&gt;');\r\n\t\t\t\t\tfor ( var i=0;i&lt;field_count;i++ ){\r\n\t\t\t\t\t\tdocument.write('&lt;tr&gt;&lt;td&gt;' + fields&#x5B;i]&#x5B;'id'] + '&lt;\/td&gt;&lt;td&gt;' + fields&#x5B;i]&#x5B;'label'] + '&lt;\/td&gt;&lt;td&gt;' + fields&#x5B;i]&#x5B;'type'] + '&lt;\/td&gt;&lt;\/tr&gt;');\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdocument.write('&lt;\/table&gt;&lt;\/td&gt;&lt;\/tr&gt;');\r\n\t\t\t\t}\r\n\t\t\t\tdocument.write('&lt;tr&gt;&lt;td colspan=&quot;3&quot;&gt;&amp;nbsp;&lt;\/td&gt;&lt;\/tr&gt;');\r\n\t\t\t}\r\n\t\t}\r\n\t\tdocument.write(&quot;&lt;\/table&gt;&quot;);\r\n\t}\r\n});\r\n&lt;\/script&gt;\r\n<\/pre>\n<h3 id=\"h-insert-forms\">Insert Forms<\/h3>\n<h4 id=\"h-insert-a-single-form\">Insert a single form<\/h4>\n<p>The example below inserts a new form.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nfunction calculate_signature( $string, $private_key ) {\r\n\t$hash = hash_hmac( 'sha1', $string, $private_key, true );\r\n\t$sig = rawurlencode( base64_encode( $hash ) );\r\n\treturn $sig;\r\n}\r\n\r\n\/\/set API keys\r\n$api_key = 'your_api_key';\r\n$private_key = 'your_private_key';\r\n\r\n\/\/set route\r\n$route = 'forms';\r\n\r\n\/\/creating request URL\r\n$expires = strtotime( '+60 mins' );\r\n$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'POST', $route, $expires );\r\n$sig = calculate_signature( $string_to_sign, $private_key );\r\n$url = 'http:\/\/localhost\/wpdev\/gravityformsapi\/' . $route . '?api_key=' . $api_key . '&amp;signature=' . $sig . '&amp;expires=' . $expires;\r\n\r\n$form = array(\r\n\t\tarray(\r\n\t\t\t'title'\t\t\t =&gt; 'API Generated Form',\r\n\t\t\t'description'\t =&gt; 'This is the description for the form generated by the API',\r\n\t\t\t'labelPlacement' =&gt; 'top_label',\r\n\t\t\t'button'\t\t =&gt; array(\r\n\t\t\t\t\t\t\t'type' =&gt; 'text'\r\n\t\t\t),\r\n\t\t\t'confirmations'\t =&gt; array(\r\n\t\t\t\t\t\tarray(\r\n\t\t\t\t\t\t\t'id' =&gt; 0,\r\n\t\t\t\t\t\t\t'name' =&gt; 'Default Confirmation',\r\n\t\t\t\t\t\t\t'type' =&gt; 'message',\r\n\t\t\t\t\t\t\t'message' =&gt; 'Thanks for contacting us! We will get in touch with you shortly.',\r\n\t\t\t\t\t\t\t'isDefault' =&gt; true,\r\n\t\t\t\t\t\t),\r\n\t\t\t),\r\n\t\t\t'fields'\t =&gt; array(\r\n\t\t\t\t\t     array(\r\n\t\t\t\t\t\t'id' =&gt; '1',\r\n\t\t\t\t\t\t'label' =&gt; 'My Text',\r\n\t\t\t\t\t\t'type'\t=&gt; 'text'\r\n\t\t\t\t\t     )\r\n\t                ),\r\n\t\t),\r\n);\r\n\r\n\/\/json encode array\r\n$form_json = json_encode( $form );\r\n\r\n\/\/retrieve data\r\n$response = wp_remote_request( $url, array( 'method' =&gt; 'POST', 'body' =&gt; $form_json ) );\r\nif ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){\r\n\t\/\/http request failed\r\n\tdie( 'There was an error attempting to access the API.' );\r\n}\r\n\r\n\/\/result is in the response &quot;body&quot; and is json encoded.\r\n$body = json_decode( wp_remote_retrieve_body( $response ), true );\r\n\r\nif( $body&#x5B;'status'] &gt; 202 ){\r\n\t$error = $body&#x5B;'response'];\r\n\r\n\t\/\/form insert failed, get error information\r\n\t$error_code \t= $error&#x5B;'code'];\r\n\t$error_message \t= $error&#x5B;'message'];\r\n\t$error_data \t= isset( $error&#x5B;'data'] ) ? $error&#x5B;'data'] : '';\r\n\t$status \t= &quot;Code: {$error_code}. Message: {$error_message}. Data: {$error_data}.&quot;;\r\n\tdie( &quot;Could not post forms. {$status}&quot; );\r\n}\r\n\r\n$form_id = $body&#x5B;'response']&#x5B;0];\r\necho 'The following form id was created: ' . $form_id . '&lt;\/br&gt;';\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;script src=&quot;https:\/\/code.jquery.com\/jquery-1.10.2.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/rollups\/hmac-sha1.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/components\/enc-base64-min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\nfunction CalculateSig(stringToSign, privateKey){\r\n\t\/\/calculate the signature needed for authentication\r\n\tvar hash = CryptoJS.HmacSHA1(stringToSign, privateKey);\r\n\tvar base64 = hash.toString(CryptoJS.enc.Base64);\r\n\treturn encodeURIComponent(base64);\r\n}\r\n\r\n\/\/set variables\r\nvar d = new Date;\r\nvar expiration = 3600; \/\/ 1 hour,\r\nvar unixtime = parseInt(d.getTime() \/ 1000);\r\nvar future_unixtime = unixtime + expiration;\r\nvar\tpublicKey = &quot;your_public_key&quot;;\r\nvar\tprivateKey = &quot;your_private_key&quot;;\r\nvar\tmethod = &quot;POST&quot;;\r\nvar route = &quot;forms&quot;;\r\n\r\nstringToSign = publicKey + &quot;:&quot; + method + &quot;:&quot; + route + &quot;:&quot; + future_unixtime;\r\nsig = CalculateSig(stringToSign, privateKey);\r\nvar url = 'http:\/\/localhost\/wp.dev\/gravityformsapi\/' + route + '?api_key=' + publicKey + '&amp;signature=' + sig + '&amp;expires=' + future_unixtime;\r\n\r\nvar form = {\r\n\ttitle\t\t\t: 'API Generated Form',\r\n\tdescription\t\t: 'This is the description for the form generated by the API',\r\n\tlabelPlacement\t: 'top_label',\r\n\tbutton\t\t\t: {type : 'text'},\r\n\tconfirmations\t: &#x5B;\r\n\t\t\t{id : 0, name : 'Default Confirmation', type : 'message', message : 'Thanks for contacting us! We will get in touch with you shortly.', isDefault : true},\r\n\t\t\t{id : 1, name : 'Confirmation 2', type : 'message', message : 'Thanks for contacting us! We will get in touch with you shortly.', isDefault : false}\r\n\t],\r\n\tfields\t\t: &#x5B;\r\n\t\t\t{id : '1', label : 'My Text', type : 'text'},\r\n\t\t\t{id : '2', label : 'More Text', type : 'text'}\r\n\t]\r\n};\r\nvar form_array = &#x5B;];\r\nform_array&#x5B;0] = form;\r\n\r\nform_json = JSON.stringify(form_array);\r\n$.post(url, form_json, function(data){\r\n\t\tconsole.log(data.response);\r\n});\r\n&lt;\/script&gt;\r\n<\/pre>\n<h4 id=\"h-insert-form-with-the-confirmation-set-to-redirect\">Insert form with the confirmation set to redirect<\/h4>\n<p>The example below shows how to build the form array to have the confirmation as a redirect.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$form = array(\r\n\t\t\tarray(\r\n\t\t\t\t'title'\t\t =&gt; 'API Generated Form With Redirect Confirmation',\r\n\t\t\t\t'description'\t =&gt; 'This is the description for the form generated by the API',\r\n\t\t\t\t'labelPlacement' =&gt; 'top_label',\r\n\t\t\t\t'button'\t\t =&gt; array(\r\n\t\t\t\t\t'type' =&gt; 'text'\r\n\t\t\t\t),\r\n\t\t\t\t'confirmations'\t =&gt; array(\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'id' =&gt; 0,\r\n\t\t\t\t\t\t'name' =&gt; 'Default Confirmation',\r\n\t\t\t\t\t\t'type' =&gt; 'redirect',\r\n\t\t\t\t\t\t'url' =&gt; 'http:\/\/www.rocketgenius.com',\r\n\t\t\t\t\t\t'isDefault' =&gt; true,\r\n\t\t\t\t\t),\r\n\t\t\t\t),\r\n\t\t\t\t'fields'\t\t =&gt; array(\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'id' =&gt; '1',\r\n\t\t\t\t\t\t'label' =&gt; 'My Text',\r\n\t\t\t\t\t\t'type'\t=&gt; 'text'\r\n\t\t\t\t\t)\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t);\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nvar form = {\r\n\ttitle\t\t: 'API Generated Form With Redirect Confirmation',\r\n\tdescription\t: 'This is the description for the form generated by the API',\r\n\tlabelPlacement\t: 'top_label',\r\n\tbutton\t\t\t: {type : 'text'},\r\n\tconfirmations\t: &#x5B;\r\n\t\t{id : 0, name : 'Default Confirmation', type : 'redirect', url : 'http:\/\/www.rocketgenius.com', isDefault : true},\r\n\t\t{id : 1, name : 'Confirmation 2', type : 'message', message : 'Thanks for contacting us! We will get in touch with you shortly.', isDefault : false}\r\n\t],\r\n\tfields\t\t\t: &#x5B;\r\n\t\t{id : '1', label : 'My Text', type : 'text'},\r\n\t\t{id : '2', label : 'More Text', type : 'text'}\r\n\t]\r\n};\r\n<\/pre>\n<h4 id=\"h-insert-form-with-the-confirmation-set-to-page\">Insert form with the confirmation set to page<\/h4>\n<p>The example below shows how to build the form array to have the confirmation as a page.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$form = array(\r\n\t\tarray(\r\n\t\t\t'title'\t\t\t =&gt; 'API Generated Form with Page Confirmation',\r\n\t\t\t'description'\t =&gt; 'This is the description for the form generated by the API',\r\n\t\t\t'labelPlacement' =&gt; 'top_label',\r\n\t\t\t'button'\t\t =&gt; array(\r\n\t\t\t\t'type' =&gt; 'text'\r\n\t\t\t),\r\n\t\t\t'confirmations'\t =&gt; array(\r\n\t\t\t\t\t      array(\r\n\t\t\t\t\t\t'id' =&gt; 0,\r\n\t\t\t\t\t\t'name' =&gt; 'Default Confirmation',\r\n\t\t\t\t\t\t'type' =&gt; 'page',\r\n\t\t\t\t\t\t'pageId' =&gt; 500,\r\n\t\t\t\t\t\t'isDefault' =&gt; true,\r\n\t\t\t\t\t      ),\r\n\t\t\t),\r\n\t\t\t'fields'  =&gt; array(\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'id' =&gt; '1',\r\n\t\t\t\t\t\t'label' =&gt; 'My Text',\r\n\t\t\t\t\t\t'type'\t=&gt; 'text'\r\n\t\t\t\t\t)\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t);\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nvar form = {\r\n\ttitle\t\t: 'API Generated Form with Page Confirmation',\r\n\tdescription\t: 'This is the description for the form generated by the API',\r\n\tlabelPlacement\t: 'top_label',\r\n\tbutton\t\t: {type : 'text'},\r\n\tconfirmations\t: &#x5B;\r\n\t\t{id : 0, name : 'Default Confirmation', type : 'page', pageId : 2, isDefault : true}\r\n\t],\r\n\tfields\t\t: &#x5B;\r\n\t\t{id : '1', label : 'My Text', type : 'text'},\r\n\t\t{id : '2', label : 'More Text', type : 'text'}\r\n\t]\r\n};\r\n<\/pre>\n<h4 id=\"h-insert-form-with-a-conditional-confirmation\">Insert form with a conditional confirmation<\/h4>\n<p>The example below shows how to build the form array to have a conditional confirmation.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$form = array(\r\n\tarray(\r\n\t\t'title'\t\t =&gt; 'API Generated Test Confirmations with new array 3',\r\n\t\t'description'\t =&gt; 'This is the description for the form generated by the API',\r\n\t\t'labelPlacement' =&gt; 'top_label',\r\n\t\t'button'\t =&gt; array(\r\n\t\t\t              'type' =&gt; 'text'\r\n\t\t                    ),\r\n\t\t'confirmations'\t =&gt; array(\r\n\t\t\t              array(\r\n\t\t\t\t        'id'        =&gt; 0,\r\n\t\t\t\t        'name'      =&gt; 'Default Confirmation',\r\n\t\t\t\t        'type'      =&gt; 'message',\r\n\t\t\t\t        'message'   =&gt; 'Thanks for contacting us! We will get in touch with you shortly.',\r\n\t\t\t\t        'isDefault' =&gt; true,\r\n\t\t\t              ),\r\n\t\t\t              array(\r\n\t\t\t\t        'id' \t    =&gt; 1,\r\n\t\t\t\t        'name'      =&gt; 'My Conditional',\r\n\t\t\t\t        'type'      =&gt; 'message',\r\n\t\t\t\t        'message'   =&gt; 'This is my conditional confirmation that will be used if the text is test.',\r\n\t\t\t\t        'isDefault' =&gt; false,\r\n\t\t\t\t        'conditionalLogic' =&gt; array(\r\n\t\t\t\t\t\t\t        'actionType' =&gt; 'show',\r\n\t\t\t\t\t\t\t\t'logicType'  =&gt; 'any',\r\n\t\t\t\t\t\t\t\t'rules'      =&gt; array(\r\n\t\t\t\t\t\t\t\t\t\t  array(\r\n\t\t\t\t\t\t\t\t\t\t    'fieldId'  =&gt; 1,\r\n\t\t\t\t\t\t\t\t\t\t    'operator' =&gt; 'is',\r\n\t\t\t\t\t\t\t\t\t\t    'value'    =&gt; 'test',\r\n\t\t\t\t\t\t\t\t\t\t  ),\r\n\t\t\t\t\t\t\t\t\t\t  array(\r\n\t\t\t\t\t\t\t\t\t\t    'fieldId'  =&gt; 1,\r\n\t\t\t\t\t\t\t\t\t\t    'operator' =&gt; 'is',\r\n\t\t\t\t\t\t\t\t\t\t    'value'    =&gt; 'TEST',\r\n\t\t\t\t\t\t\t\t\t\t  ),\r\n\t\t\t\t\t\t\t\t\t\t  array(\r\n\t\t\t\t\t\t\t\t\t\t    'fieldId'  =&gt; 1,\r\n\t\t\t\t\t\t\t\t\t\t    'operator' =&gt; 'is',\r\n\t\t\t\t\t\t\t\t\t\t    'value'    =&gt; 'Test',\r\n\t\t\t\t\t\t\t\t\t\t  ),\r\n                                                                                ),\r\n\t\t\t\t\t\t\t     ),\r\n\t\t\t            )\r\n\t\t),\r\n\t\t'fields' =&gt; array(\r\n\t\t\t      array(\r\n\t\t\t\t'id' =&gt; '1',\r\n\t\t\t\t'label' =&gt; 'My Text',\r\n\t\t\t\t'type'\t=&gt; 'text'\r\n\t\t\t     )\r\n\t\t),\r\n\t),\r\n);\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nvar form = {\r\n\ttitle\t\t: 'API Generated Test Confirmations Conditionals',\r\n\tdescription\t: 'This is the description for the form generated by the API',\r\n\tlabelPlacement  : 'top_label',\r\n\tbutton\t\t: {type : 'text'},\r\n\tconfirmations\t: &#x5B;\r\n\t\t{id : '0', name : 'Default Confirmation', type : 'message', message : 'Thanks for contacting us! We will get in touch with you shortly.', isDefault : true},\r\n\t\t{id : '1', name : 'My Conditional', type : 'message', message : 'This is my conditional confirmation that will be used if the text is test.', isDefault : false,\r\n\t\t\tconditionalLogic : {actionType : 'show', logicType : 'any',\r\n\t\t\t\trules : &#x5B;\r\n\t\t\t\t\t{fieldId : '1', operator : 'is', value : 'test'},\r\n\t\t\t\t\t{fieldId : '1', operator : 'is', value : 'TEST'},\r\n\t\t\t\t\t{fieldId : '1', operator : 'is', value : 'Test'}\r\n\t\t\t\t]\r\n\t\t\t}\r\n\t\t}\r\n\t],\r\n\tfields\t\t: &#x5B;\r\n\t\t{id : '1', label : 'My Text', type : 'text'},\r\n\t\t{id : '2', label : 'More Text', type : 'text'}\r\n\t]\r\n};\r\n<\/pre>\n<h4 id=\"h-insert-form-with-notifications-sent-to-a-specific-email-address\">Insert form with notifications sent to a specific email address<\/h4>\n<p>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 <a data-autolink=\"autolink_notifications-object\" href=\"\/notifications-object\">Notifications Object<\/a> for more details about what may be included when building the notification array.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$form = array(\r\n\t\t\tarray(\r\n\t\t\t\t'title'\t\t\t =&gt; 'API Generated Form With Notification Sent to Specific Email Address',\r\n\t\t\t\t'description'\t =&gt; 'This is the description for the form generated by the API',\r\n\t\t\t\t'labelPlacement' =&gt; 'top_label',\r\n\t\t\t\t'button'\t\t =&gt; array(\r\n\t\t\t\t\t'type' =&gt; 'text'\r\n\t\t\t\t),\r\n\t\t\t\t'notifications' =&gt; array(\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'id'\t\t=&gt; uniqid( '0' ),\r\n\t\t\t\t\t\t'name'\t\t=&gt; 'Admin Notification',\r\n\t\t\t\t\t\t'to'\t\t=&gt; '{admin_email}',\r\n\t\t\t\t\t\t'toType'\t=&gt; 'email',\r\n\t\t\t\t\t\t'event'\t\t=&gt; 'form_submission',\r\n\t\t\t\t\t\t'subject'\t=&gt; 'New submission from {form_title}',\r\n\t\t\t\t\t\t'message'\t=&gt; '{all_fields}',\r\n\t\t\t\t\t\t'from'\t\t=&gt; '{admin_email}',\r\n\t\t\t\t\t\t'fromName'\t=&gt; 'Administrator'\r\n\t\t\t\t\t),\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'id'\t\t=&gt; uniqid( '1' ),\r\n\t\t\t\t\t\t'name'\t\t=&gt; 'Admin Notification 2',\r\n\t\t\t\t\t\t'to'\t\t=&gt; '{admin_email}',\r\n\t\t\t\t\t\t'toType'\t=&gt; 'email',\r\n\t\t\t\t\t\t'event'\t\t=&gt; 'form_submission',\r\n\t\t\t\t\t\t'subject'\t=&gt; 'New submission from {form_title}',\r\n\t\t\t\t\t\t'message'\t=&gt; '{all_fields}',\r\n\t\t\t\t\t\t'from'\t\t=&gt; '{admin_email}',\r\n\t\t\t\t\t\t'isActive'\t=&gt; false,\r\n\t\t\t\t\t),\r\n\t\t\t\t),\r\n\t\t\t\t'confirmations'\t =&gt; array(\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'id' =&gt; 0,\r\n\t\t\t\t\t\t'name' =&gt; 'Default Confirmation',\r\n\t\t\t\t\t\t'type' =&gt; 'message',\r\n\t\t\t\t\t\t'message' =&gt; 'Thanks for contacting us! We will get in touch with you shortly.',\r\n\t\t\t\t\t\t'isDefault' =&gt; true,\r\n\t\t\t\t\t),\r\n\t\t\t\t),\r\n\t\t\t\t'fields'\t\t =&gt; array(\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'id' =&gt; '1',\r\n\t\t\t\t\t\t'label' =&gt; 'My Text',\r\n\t\t\t\t\t\t'type'\t=&gt; 'text'\r\n\t\t\t\t\t)\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t);\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nvar form = {\r\n\ttitle\t\t: 'API Generated Form With Notification Sent to Specific Email Address',\r\n\tdescription\t: 'This is the description for the form generated by the API',\r\n\tlabelPlacement\t: 'top_label',\r\n\tbutton\t\t: {type : 'text'},\r\n\tconfirmations\t: &#x5B;\r\n\t\t{id : '0', name : 'Default Confirmation', type : 'message', message : 'Thanks for contacting us! We will get in touch with you shortly.', isDefault : true}\r\n\t],\r\n\tfields\t\t: &#x5B;\r\n\t\t{id : '1', label : 'My Text', type : 'text'},\r\n\t\t{id : '2', label : 'More Text', type : 'text'}\r\n\t],\r\n\tnotifications : &#x5B;\r\n\t\t{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'},\r\n\t\t{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}\r\n\t]\r\n};\r\n<\/pre>\n<h4 id=\"h-insert-form-with-notification-set-to-use-an-email-field\">Insert form with notification set to use an email field<\/h4>\n<p>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 <a data-autolink=\"autolink_notifications-object\" href=\"\/notifications-object\">Notifications Object<\/a> for more details about what may be included when building the notification array.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$form = array(\r\n\t\t\tarray(\r\n\t\t\t\t'title'\t\t\t =&gt; 'API Generated Form With Notification Set to Field',\r\n\t\t\t\t'description'\t =&gt; 'This is the description for the form generated by the API',\r\n\t\t\t\t'labelPlacement' =&gt; 'top_label',\r\n\t\t\t\t'button'\t\t =&gt; array(\r\n\t\t\t\t\t'type' =&gt; 'text'\r\n\t\t\t\t),\r\n\t\t\t\t'notifications' =&gt; array(\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'id'\t\t=&gt; uniqid( '0' ),\r\n\t\t\t\t\t\t'name'\t\t=&gt; 'Admin Notification',\r\n\t\t\t\t\t\t'to'\t\t=&gt; '2',\r\n\t\t\t\t\t\t'toType'\t=&gt; 'field',\r\n\t\t\t\t\t\t'event'\t\t=&gt; 'form_submission',\r\n\t\t\t\t\t\t'subject'\t=&gt; 'New submission from {form_title}',\r\n\t\t\t\t\t\t'message'\t=&gt; '{all_fields}',\r\n\t\t\t\t\t\t'from'\t\t=&gt; '{admin_email}',\r\n\t\t\t\t\t\t'fromName'\t=&gt; 'Administrator'\r\n\t\t\t\t\t),\r\n\t\t\t\t),\r\n\t\t\t\t'confirmations'\t =&gt; array(\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'id' =&gt; uniqid(),\r\n\t\t\t\t\t\t'name' =&gt; 'Default Confirmation',\r\n\t\t\t\t\t\t'type' =&gt; 'message',\r\n\t\t\t\t\t\t'message' =&gt; 'Thanks for contacting us! We will get in touch with you shortly.',\r\n\t\t\t\t\t\t'isDefault' =&gt; true,\r\n\t\t\t\t\t),\r\n\t\t\t\t),\r\n\t\t\t\t'fields'\t\t =&gt; array(\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'id' =&gt; '1',\r\n\t\t\t\t\t\t'label' =&gt; 'My Text',\r\n\t\t\t\t\t\t'type'\t=&gt; 'text'\r\n\t\t\t\t\t),\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'id' =&gt; '2',\r\n\t\t\t\t\t\t'label' =&gt; 'Email',\r\n\t\t\t\t\t\t'type'\t=&gt; 'email'\r\n\t\t\t\t\t),\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t);\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nvar form = {\r\n\ttitle\t\t: 'API Generated Form With Notification Sent to Specific Email Address',\r\n\tdescription\t: 'This is the description for the form generated by the API',\r\n\tlabelPlacement\t: 'top_label',\r\n\tbutton\t\t: {type : 'text'},\r\n\tconfirmations\t: &#x5B;\r\n\t\t{id : '0', name : 'Default Confirmation', type : 'message', message : 'Thanks for contacting us! We will get in touch with you shortly.', isDefault : true}\r\n\t],\r\n\tfields\t\t: &#x5B;\r\n\t\t{id : '1', label : 'My Text', type : 'text'},\r\n\t\t{id : '2', label : 'More Text', type : 'text'},\r\n\t\t{id : '3', label : 'Email', type : 'email'}\r\n\t],\r\n\tnotifications : &#x5B;\r\n\t\t{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'}\r\n\t]\r\n};\r\n<\/pre>\n<h4 id=\"h-insert-form-with-notification-set-to-use-routing\">Insert form with notification set to use routing<\/h4>\n<p>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 <a data-autolink=\"autolink_notifications-object\" href=\"\/notifications-object\">Notifications Object<\/a> for more details about what may be included when building the notification array.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$form = array(\r\n\t\t\tarray(\r\n\t\t\t\t'title'\t\t\t =&gt; 'API Generated Test Confirmations with new array 3',\r\n\t\t\t\t'description'\t =&gt; 'This is the description for the form generated by the API',\r\n\t\t\t\t'labelPlacement' =&gt; 'top_label',\r\n\t\t\t\t'button'\t\t =&gt; array(\r\n\t\t\t\t\t'type' =&gt; 'text'\r\n\t\t\t\t),\r\n\t\t\t\t'notifications' =&gt; array(\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'id'\t\t=&gt; uniqid( '0' ),\r\n\t\t\t\t\t\t'name'\t\t=&gt; 'Admin Notification',\r\n\t\t\t\t\t\t'toType'\t=&gt; 'routing',\r\n\t\t\t\t\t\t'event'\t\t=&gt; 'form_submission',\r\n\t\t\t\t\t\t'subject'\t=&gt; 'New submission from {form_title}',\r\n\t\t\t\t\t\t'message'\t=&gt; '{all_fields}',\r\n\t\t\t\t\t\t'from'\t\t=&gt; '{admin_email}',\r\n\t\t\t\t\t\t'fromName'\t=&gt; 'Administrator',\r\n\t\t\t\t\t\t'isActive'\t=&gt; true,\r\n\t\t\t\t\t\t'routing'\t=&gt; array(\r\n\t\t\t\t\t\t\t\t\t\t\tarray(\r\n\t\t\t\t\t\t\t\t\t\t\t\t'fieldId'  =&gt; '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t'operator' =&gt; 'is',\r\n\t\t\t\t\t\t\t\t\t\t\t\t'value'    =&gt; 'test',\r\n\t\t\t\t\t\t\t\t\t\t\t\t'email'    =&gt; '{admin_email}',\r\n\t\t\t\t\t\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\t\t\t\t\tarray(\r\n\t\t\t\t\t\t\t\t\t\t\t\t'fieldId'  =&gt; '2',\r\n\t\t\t\t\t\t\t\t\t\t\t\t'operator' =&gt; 'is',\r\n\t\t\t\t\t\t\t\t\t\t\t\t'value'    =&gt; 'test@rocketgenius.com',\r\n\t\t\t\t\t\t\t\t\t\t\t\t'email'    =&gt; '{admin_email}',\r\n\t\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t),\r\n\t\t\t\t),\r\n\t\t\t\t'confirmations'\t =&gt; array(\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'id' =&gt; uniqid(),\r\n\t\t\t\t\t\t'name' =&gt; 'Default Confirmation',\r\n\t\t\t\t\t\t'type' =&gt; 'message',\r\n\t\t\t\t\t\t'message' =&gt; 'Thanks for contacting us! We will get in touch with you shortly.',\r\n\t\t\t\t\t\t'isDefault' =&gt; true,\r\n\t\t\t\t\t),\r\n\t\t\t\t),\r\n\t\t\t\t'fields'\t\t =&gt; array(\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'id' =&gt; '1',\r\n\t\t\t\t\t\t'label' =&gt; 'My Text',\r\n\t\t\t\t\t\t'type'\t=&gt; 'text'\r\n\t\t\t\t\t),\r\n\t\t\t\t\tarray(\r\n\t\t\t\t\t\t'id' =&gt; '2',\r\n\t\t\t\t\t\t'label' =&gt; 'Email',\r\n\t\t\t\t\t\t'type'\t=&gt; 'email'\r\n\t\t\t\t\t),\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t);\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nvar form = {\r\n\ttitle\t\t: 'API Generated Form With Notification Sent to Specific Email Address',\r\n\tdescription\t: 'This is the description for the form generated by the API',\r\n\tlabelPlacement\t: 'top_label',\r\n\tbutton\t\t: {type : 'text'},\r\n\tconfirmations\t: &#x5B;\r\n\t\t{id : '0', name : 'Default Confirmation', type : 'message', message : 'Thanks for contacting us! We will get in touch with you shortly.', isDefault : true}\r\n\t],\r\n\tfields\t\t: &#x5B;\r\n\t\t{id : '1', label : 'My Text', type : 'text'},\r\n\t\t{id : '2', label : 'More Text', type : 'text'},\r\n\t\t{id : '3', label : 'Email', type : 'email'}\r\n\t],\r\n\tnotifications : &#x5B;\r\n\t\t{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,\r\n\t\trouting : &#x5B;\r\n\t\t\t{fieldId : '1', operator : 'is', value : 'test', email : '{admin_email}'},\r\n\t\t\t{fieldId : '2', operator : 'is', value : 'test@rocketgenius.com', email : '{admin_email}'}\r\n\t\t]\r\n\t\t}\r\n\t]\r\n};\r\n<\/pre>\n<h4 id=\"h-insert-multiple-forms\">Insert multiple forms<\/h4>\n<p>The example below inserts two new forms and displays the ids of the forms inserted.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nfunction calculate_signature( $string, $private_key ) {\r\n\t$hash = hash_hmac( 'sha1', $string, $private_key, true );\r\n\t$sig = rawurlencode( base64_encode( $hash ) );\r\n\treturn $sig;\r\n}\r\n\r\n\/\/set API keys\r\n$api_key = 'your_api_key';\r\n$private_key = 'your_private_key';\r\n\r\n\/\/set route\r\n$route = 'forms';\r\n\r\n\/\/creating request URL\r\n$expires = strtotime( '+60 mins' );\r\n$string_to_sign = sprintf( '%s:%s:%s:%s', $api_key, 'POST', $route, $expires );\r\n$sig = calculate_signature( $string_to_sign, $private_key );\r\n$url = 'http:\/\/localhost\/wpdev\/gravityformsapi\/' . $route . '?api_key=' . $api_key . '&amp;signature=' . $sig . '&amp;expires=' . $expires;\r\n\r\n$form = array(\r\n\tarray(\r\n\t\t'title'\t\t\t =&gt; 'API Generated Form 1',\r\n\t\t'description'\t =&gt; 'This is the description for the form generated by the API',\r\n\t\t'labelPlacement' =&gt; 'top_label',\r\n\t\t'button'\t\t =&gt; array(\r\n\t\t\t\t\t\t\t\t'type' =&gt; 'text'\r\n\t\t),\r\n\t\t'confirmations'\t =&gt; array(\r\n\t\t\tarray(\r\n\t\t\t\t'id' =&gt; 0,\r\n\t\t\t\t'name' =&gt; 'Default Confirmation',\r\n\t\t\t\t'type' =&gt; 'message',\r\n\t\t\t\t'message' =&gt; 'Thanks for contacting us! We will get in touch with you shortly.',\r\n\t\t\t\t'isDefault' =&gt; true,\r\n\t\t\t),\r\n\t\t),\r\n\t\t'fields'\t\t =&gt; array(\r\n\t\t\tarray(\r\n\t\t\t\t'id' =&gt; '1',\r\n\t\t\t\t'label' =&gt; 'My Text',\r\n\t\t\t\t'type'\t=&gt; 'text'\r\n\t\t\t)\r\n\t\t),\r\n\t),\r\n\tarray(\r\n\t\t'title'\t\t\t =&gt; 'API Generated Form 2',\r\n\t\t'description'\t =&gt; 'This is the description for the form generated by the API',\r\n\t\t'labelPlacement' =&gt; 'top_label',\r\n\t\t'button'\t\t =&gt; array(\r\n\t\t\t'type' =&gt; 'text'\r\n\t\t),\r\n\t\t'confirmations'\t =&gt; array(\r\n\t\t\tarray(\r\n\t\t\t\t'id' =&gt; 0,\r\n\t\t\t\t'name' =&gt; 'Default Confirmation',\r\n\t\t\t\t'type' =&gt; 'message',\r\n\t\t\t\t'message' =&gt; 'Thanks for contacting us! We will get in touch with you shortly.',\r\n\t\t\t\t'isDefault' =&gt; true,\r\n\t\t\t),\r\n\t\t),\r\n\t\t'fields'\t\t =&gt; array(\r\n\t\t\tarray(\r\n\t\t\t\t'id' =&gt; '1',\r\n\t\t\t\t'label' =&gt; 'My Text',\r\n\t\t\t\t'type'\t=&gt; 'text'\r\n\t\t\t)\r\n\t\t),\r\n\t),\r\n);\r\n\r\n\/\/json encode array\r\n$form_json = json_encode( $form );\r\n\r\n\/\/retrieve data\r\n$response = wp_remote_request( $url, array( 'method' =&gt; 'POST', 'body' =&gt; $form_json ) );\r\nif ( wp_remote_retrieve_response_code( $response ) != 200 || ( empty( wp_remote_retrieve_body( $response ) ) ) ){\r\n\t\/\/http request failed\r\n\tdie( 'There was an error attempting to access the API.' );\r\n}\r\n\r\n\/\/result is in the response &quot;body&quot; and is json encoded.\r\n$body = json_decode( wp_remote_retrieve_body( $response ), true );\r\n\r\n\/\/echo $response&#x5B;'body'];\r\n\r\n\r\nif( $body&#x5B;'status'] &gt; 202 ){\r\n\t$error = $body&#x5B;'response'];\r\n\r\n\t\/\/form insert failed, get error information\r\n\t$error_code \t= $error&#x5B;'code'];\r\n\t$error_message \t= $error&#x5B;'message'];\r\n\t$error_data \t= isset( $error&#x5B;'data'] ) ? $error&#x5B;'data'] : '';\r\n\t$status \t= &quot;Code: {$error_code}. Message: {$error_message}. Data: {$error_data}.&quot;;\r\n\tdie( &quot;Could not post forms. {$status}&quot; );\r\n}\r\n\r\n$form_ids = $body&#x5B;'response'];\r\n$form_ids_created = '';\r\nforeach ( $form_ids as $form_id ){\r\n\t$form_ids_created .= $form_id . '&lt;\/br&gt;';\r\n}\r\necho 'The following form ids were created: ' . $form_ids_created . '&lt;\/br&gt;';\r\n<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;script src=&quot;https:\/\/code.jquery.com\/jquery-1.10.2.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/rollups\/hmac-sha1.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/crypto-js\/3.1.2\/components\/enc-base64-min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\nfunction CalculateSig(stringToSign, privateKey){\r\n\t\/\/calculate the signature needed for authentication\r\n\tvar hash = CryptoJS.HmacSHA1(stringToSign, privateKey);\r\n\tvar base64 = hash.toString(CryptoJS.enc.Base64);\r\n\treturn encodeURIComponent(base64);\r\n}\r\n\r\n\/\/set variables\r\nvar d = new Date;\r\nvar expiration = 3600; \/\/ 1 hour,\r\nvar unixtime = parseInt(d.getTime() \/ 1000);\r\nvar future_unixtime = unixtime + expiration;\r\nvar publicKey = &quot;your_public_key&quot;;\r\nvar privateKey = &quot;your_private_key&quot;;\r\nvar method = &quot;POST&quot;;\r\nvar route = &quot;forms&quot;;\r\n\r\nstringToSign = publicKey + &quot;:&quot; + method + &quot;:&quot; + route + &quot;:&quot; + future_unixtime;\r\nsig = CalculateSig(stringToSign, privateKey);\r\nvar url = 'http:\/\/localhost\/wp.dev\/gravityformsapi\/' + route + '?api_key=' + publicKey + '&amp;signature=' + sig + '&amp;expires=' + future_unixtime;\r\n\r\nvar forms = &#x5B;\r\n\t{\r\n\t\ttitle\t\t: 'API Generated Form 1',\r\n\t\tdescription\t: 'This is the description for the form generated by the API',\r\n\t\tlabelPlacement\t: 'top_label',\r\n\t\tbutton\t\t: {type : 'text'},\r\n\t\tconfirmations\t: &#x5B;\r\n\t\t\t{id : '0', name : 'Default Confirmation', type : 'message', message : 'Thanks for contacting us! We will get in touch with you shortly.', isDefault : true}\r\n\t\t],\r\n\t\tfields\t\t: &#x5B;\r\n\t\t\t{id : '1', label : 'My Text', type : 'text'},\r\n\t\t\t{id : '2', label : 'More Text', type : 'text'},\r\n\t\t\t{id : '3', label : 'Email', type : 'email'}\r\n\t\t],\r\n\t},\r\n\t{\r\n\t\ttitle\t\t: 'API Generated Form 2',\r\n\t\tdescription\t: 'This is the description for the form generated by the API',\r\n\t\tlabelPlacement\t: 'top_label',\r\n\t\tbutton\t\t: {type : 'text'},\r\n\t\tconfirmations\t: &#x5B;\r\n\t\t\t{id : '0', name : 'Default Confirmation', type : 'message', message : 'Thanks for contacting us! We will get in touch with you shortly.', isDefault : true}\r\n\t\t],\r\n\t\tfields\t\t: &#x5B;\r\n\t\t\t{id : '1', label : 'My Text 2', type : 'text'},\r\n\t\t\t{id : '2', label : 'More Text 2', type : 'text'},\r\n\t\t\t{id : '3', label : 'Email 2', type : 'email'}\r\n\t\t],\r\n\t}\r\n];\r\n\r\nform_json = JSON.stringify(forms);\r\n\r\n$.post(url, form_json, function(data){\r\n\tdocument.write('Inserted Ids: ' + data.response);\r\n});\r\n&lt;\/script&gt;\r\n<\/pre>\n<h3 id=\"h-update-forms\">Update Forms<\/h3>\n<h4 id=\"h-update-multiple-forms\">Update multiple forms<\/h4>\n<p>This example may be viewed in the <a href=\"https:\/\/docs.gravityforms.com\/web-api#put_forms\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<h3 id=\"h-delete-forms\">Delete Forms<\/h3>\n<p>This example may be viewed in the <a href=\"https:\/\/docs.gravityforms.com\/web-api#delete_forms\" target=\"_blank\">REST API v1<\/a> article.<\/p>\n<h2 id=\"h-form-submissions\">Form Submissions<\/h2>\n<h3 id=\"h-complex-fields\">Complex Fields<\/h3>\n<h4 id=\"h-submit-a-list-field-that-has-a-single-column\">Submit a list field that has a single column<\/h4>\n<p>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.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$values = array(\r\n            'input_values' =&gt; array(\r\n                                'input_1' =&gt; array('row1','row2'),\r\n                                'input_2' =&gt; 'test'\r\n\t\t\t      )\r\n\t     );\r\n<\/pre>\n<h4 id=\"h-submit-a-list-field-that-has-multiple-columns\">Submit a list field that has multiple columns<\/h4>\n<p>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 &#8221; if there is no value for a column in a particular row. The value &#8216;test&#8217; in the example starts a fourth row.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$values = array(\r\n            'input_values' =&gt; array(\r\n                                'input_1' =&gt; array('row1col1','row1col2','row1col3','row2col1','row2col2','row3col3','row3col1','row3col2','row3col3','test'),\r\n\t\t\t      )\r\n\t    );\r\n<\/pre>\n<h4 id=\"h-submit-a-multi-select-field\">Submit a Multi-Select Field<\/h4>\n<p>This example shows how to create the input_values array for a multi-select field (field 1).<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$values = array(\r\n            'input_values' =&gt; array(\r\n                                'input_1' =&gt; array('First Choice','Third Choice'),\r\n\t\t\t      )\r\n\t    );\r\n<\/pre>\n<h3 id=\"h-pricing-fields\">Pricing Fields<\/h3>\n<h4 id=\"h-single-product-field\">Single Product Field<\/h4>\n<p>This example shows how to create the input_values array for a Single Product Pricing field (field 1).<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$values = array(\r\n            'input_values' =&gt; array(\r\n                                'input_1_1' =&gt; 'test product', \/\/product name\r\n                                'input_1_2' =&gt; '$5.00', \/\/product price with formatting\r\n                                'input_1_3' =&gt; 1, \/\/product quantity\r\n\r\n                              )\r\n          );\r\n<\/pre>\n<h4 id=\"h-single-product-field-with-option\">Single Product Field With Option<\/h4>\n<p>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.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$values = array(\r\n            'input_values' =&gt; array(\r\n                                'input_1_1' =&gt; 'test product', \/\/product name\r\n                                'input_1_2' =&gt; '$5.00', \/\/product price with formatting\r\n                                'input_1_3' =&gt; 1, \/\/product quantity\r\n                                'input_2'   =&gt; 'Second Option|4' \/\/option name|option price\r\n\r\n                              )\r\n          );\r\n\r\n<\/pre>\n<h4 id=\"h-option-field-as-a-checkbox\">Option Field as a Checkbox<\/h4>\n<p>This example shows how to create the input_values array when the option associated to a product is a checkbox.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$values = array(\r\n            'input_values' =&gt; array(\r\n                                'input_1_1' =&gt; 'test product', \/\/product name\r\n                                'input_1_2' =&gt; '$5.00', \/\/product price with formatting\r\n                                'input_1_3' =&gt; 1, \/\/product quantity\r\n                                'input_2_1' =&gt; 'First Option|2', \/\/option name|option price\r\n                                'input_2_3' =&gt; 'Third Option|6'\r\n                              )\r\n          );\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This article includes more detailed examples of how to interact with the REST API v1. It is a work in progress. More examples will be added over time.<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_autodraft_ids":[],"_sb_is_suggestion_mode":false,"_sb_show_suggestion_boards":false,"_sb_show_comment_boards":false,"_sb_suggestion_history":"","_sb_update_block_changes":"","_is_real_time_mode":false,"_realtime_collaborators":"","footnotes":"","jetpack_post_was_ever_published":false,"cf_checklist_status":[]},"categories":[12526],"tags":[],"class_list":["post-8823","post","type-post","status-publish","format-standard","hentry","category-rest-api","wpautop"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.9 (Yoast SEO v27.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>v1 Examples - Gravity Forms Documentation<\/title>\n<meta name=\"description\" content=\"This article includes more detailed examples of how to interact with the REST API v1. It is a work in progress. More examples will be added over time.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/docs.gravityforms.com\/web-api-examples\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"v1 Examples\" \/>\n<meta property=\"og:description\" content=\"This article includes more detailed examples of how to interact with the REST API v1. It is a work in progress. More examples will be added over time.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/docs.gravityforms.com\/web-api-examples\/\" \/>\n<meta property=\"og:site_name\" content=\"Gravity Forms Documentation\" \/>\n<meta property=\"article:published_time\" content=\"2015-08-11T20:17:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-02-12T16:56:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/docs.gravityforms.com\/wp-content\/uploads\/2023\/08\/gf-docs-default-v3.png\" \/>\n\t<meta property=\"og:image:width\" content=\"544\" \/>\n\t<meta property=\"og:image:height\" content=\"288\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Justin Pakes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@gravityforms\" \/>\n<meta name=\"twitter:site\" content=\"@gravityforms\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Justin Pakes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"63 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/web-api-examples\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/web-api-examples\\\/\"},\"author\":{\"name\":\"Justin Pakes\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#\\\/schema\\\/person\\\/8a88745ec2ee5bc1bb24eea8634bf376\"},\"headline\":\"v1 Examples\",\"datePublished\":\"2015-08-11T20:17:18+00:00\",\"dateModified\":\"2019-02-12T16:56:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/web-api-examples\\\/\"},\"wordCount\":11792,\"publisher\":{\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#organization\"},\"articleSection\":[\"REST API\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/web-api-examples\\\/\",\"url\":\"https:\\\/\\\/docs.gravityforms.com\\\/web-api-examples\\\/\",\"name\":\"v1 Examples - Gravity Forms Documentation\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#website\"},\"datePublished\":\"2015-08-11T20:17:18+00:00\",\"dateModified\":\"2019-02-12T16:56:42+00:00\",\"description\":\"This article includes more detailed examples of how to interact with the REST API v1. It is a work in progress. More examples will be added over time.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/web-api-examples\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/docs.gravityforms.com\\\/web-api-examples\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/web-api-examples\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/docs.gravityforms.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"v1 Examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#website\",\"url\":\"https:\\\/\\\/docs.gravityforms.com\\\/\",\"name\":\"Gravity Forms Documentation\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/docs.gravityforms.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#organization\",\"name\":\"Gravity Forms\",\"url\":\"https:\\\/\\\/docs.gravityforms.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/docs.gravityforms.com\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/gravity-forms-2020-logo-stacked.png\",\"contentUrl\":\"https:\\\/\\\/docs.gravityforms.com\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/gravity-forms-2020-logo-stacked.png\",\"width\":392,\"height\":515,\"caption\":\"Gravity Forms\"},\"image\":{\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/gravityforms\",\"http:\\\/\\\/@gravityforms.com\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#\\\/schema\\\/person\\\/8a88745ec2ee5bc1bb24eea8634bf376\",\"name\":\"Justin Pakes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/791cb5bec00c6dd4bec2e80cf4df9638297207d8f77890c96b6b483be434ecea?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/791cb5bec00c6dd4bec2e80cf4df9638297207d8f77890c96b6b483be434ecea?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/791cb5bec00c6dd4bec2e80cf4df9638297207d8f77890c96b6b483be434ecea?s=96&d=mm&r=g\",\"caption\":\"Justin Pakes\"},\"url\":\"https:\\\/\\\/docs.gravityforms.com\\\/author\\\/pakes\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"v1 Examples - Gravity Forms Documentation","description":"This article includes more detailed examples of how to interact with the REST API v1. It is a work in progress. More examples will be added over time.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/docs.gravityforms.com\/web-api-examples\/","og_locale":"en_US","og_type":"article","og_title":"v1 Examples","og_description":"This article includes more detailed examples of how to interact with the REST API v1. It is a work in progress. More examples will be added over time.","og_url":"https:\/\/docs.gravityforms.com\/web-api-examples\/","og_site_name":"Gravity Forms Documentation","article_published_time":"2015-08-11T20:17:18+00:00","article_modified_time":"2019-02-12T16:56:42+00:00","og_image":[{"width":544,"height":288,"url":"https:\/\/docs.gravityforms.com\/wp-content\/uploads\/2023\/08\/gf-docs-default-v3.png","type":"image\/png"}],"author":"Justin Pakes","twitter_card":"summary_large_image","twitter_creator":"@gravityforms","twitter_site":"@gravityforms","twitter_misc":{"Written by":"Justin Pakes","Est. reading time":"63 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/docs.gravityforms.com\/web-api-examples\/#article","isPartOf":{"@id":"https:\/\/docs.gravityforms.com\/web-api-examples\/"},"author":{"name":"Justin Pakes","@id":"https:\/\/docs.gravityforms.com\/#\/schema\/person\/8a88745ec2ee5bc1bb24eea8634bf376"},"headline":"v1 Examples","datePublished":"2015-08-11T20:17:18+00:00","dateModified":"2019-02-12T16:56:42+00:00","mainEntityOfPage":{"@id":"https:\/\/docs.gravityforms.com\/web-api-examples\/"},"wordCount":11792,"publisher":{"@id":"https:\/\/docs.gravityforms.com\/#organization"},"articleSection":["REST API"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/docs.gravityforms.com\/web-api-examples\/","url":"https:\/\/docs.gravityforms.com\/web-api-examples\/","name":"v1 Examples - Gravity Forms Documentation","isPartOf":{"@id":"https:\/\/docs.gravityforms.com\/#website"},"datePublished":"2015-08-11T20:17:18+00:00","dateModified":"2019-02-12T16:56:42+00:00","description":"This article includes more detailed examples of how to interact with the REST API v1. It is a work in progress. More examples will be added over time.","breadcrumb":{"@id":"https:\/\/docs.gravityforms.com\/web-api-examples\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/docs.gravityforms.com\/web-api-examples\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/docs.gravityforms.com\/web-api-examples\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/docs.gravityforms.com\/"},{"@type":"ListItem","position":2,"name":"v1 Examples"}]},{"@type":"WebSite","@id":"https:\/\/docs.gravityforms.com\/#website","url":"https:\/\/docs.gravityforms.com\/","name":"Gravity Forms Documentation","description":"","publisher":{"@id":"https:\/\/docs.gravityforms.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/docs.gravityforms.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/docs.gravityforms.com\/#organization","name":"Gravity Forms","url":"https:\/\/docs.gravityforms.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/docs.gravityforms.com\/#\/schema\/logo\/image\/","url":"https:\/\/docs.gravityforms.com\/wp-content\/uploads\/2020\/01\/gravity-forms-2020-logo-stacked.png","contentUrl":"https:\/\/docs.gravityforms.com\/wp-content\/uploads\/2020\/01\/gravity-forms-2020-logo-stacked.png","width":392,"height":515,"caption":"Gravity Forms"},"image":{"@id":"https:\/\/docs.gravityforms.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/gravityforms","http:\/\/@gravityforms.com"]},{"@type":"Person","@id":"https:\/\/docs.gravityforms.com\/#\/schema\/person\/8a88745ec2ee5bc1bb24eea8634bf376","name":"Justin Pakes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/791cb5bec00c6dd4bec2e80cf4df9638297207d8f77890c96b6b483be434ecea?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/791cb5bec00c6dd4bec2e80cf4df9638297207d8f77890c96b6b483be434ecea?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/791cb5bec00c6dd4bec2e80cf4df9638297207d8f77890c96b6b483be434ecea?s=96&d=mm&r=g","caption":"Justin Pakes"},"url":"https:\/\/docs.gravityforms.com\/author\/pakes\/"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pdGaEa-2ij","_links":{"self":[{"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/posts\/8823","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/comments?post=8823"}],"version-history":[{"count":1,"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/posts\/8823\/revisions"}],"predecessor-version":[{"id":20844,"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/posts\/8823\/revisions\/20844"}],"wp:attachment":[{"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/media?parent=8823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/categories?post=8823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/tags?post=8823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}