Entries - Fetch
Retrieve Gravity Forms entries using SQL Server
- See SQLHTTP easy setup for Gravity Forms
- See API Call documentation for parameter values and other information
- Create the stored procedure documented below
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
CREATE PROCEDURE usp_GravityForms_Entries_Fetch( @Profile nvarchar(100), @FormID int, @PageSize int = 100, @Offset int = 0, @Response nvarchar(MAX) OUTPUT, @StatusCode int OUTPUT, @StatusDescription nvarchar(MAX) OUTPUT) AS DECLARE @URL nvarchar(MAX) DECLARE @QueryString nvarchar(MAX) DECLARE @HTTPSessionID uniqueidentifier DECLARE @Path nvarchar(MAX) DECLARE @PublicKey nvarchar(100) DECLARE @UNIXTime bigint DECLARE @Signature varchar(100) SET @URL = SQLHTTP.net.AuthParam(@Profile, 'RootURL') SET @Path = N'forms/' COLLATE SQL_Latin1_General_CP1_CI_AS + CONVERT(nvarchar(10), @FormID) + N'/entries' COLLATE SQL_Latin1_General_CP1_CI_AS EXEC usp_GravityForms_AuthParameters @Profile = @Profile, @Method = 'GET', @Path = @Path, @PublicKey = @PublicKey OUTPUT, @UNIXTime = @UNIXTime OUTPUT, @Signature = @Signature OUTPUT SET @URL = @URL + N'/gravityformsapi/' COLLATE SQL_Latin1_General_CP1_CI_AS + @Path EXEC SQLHTTP.net.QueryStringBuilder @QueryString OUTPUT, @Profile, 'api_key', @PublicKey, 'expires', @UNIXTime, 'paging[page_size]', @PageSize, 'paging[offset]', @Offset SET @URL = @URL + @QueryString + '&signature=' COLLATE SQL_Latin1_General_CP1_CI_AS + @Signature EXEC SQLHTTP.net.HttpSession @HttpSessionID OUTPUT EXEC SQLHTTP.net.HttpRequest @HttpSessionID, @URL = @URL, @AllowAutoRedirect = 1, @Response = @Response OUTPUT, @StatusCode = @StatusCode OUTPUT, @StatusDescription = @StatusDescription OUTPUT GO |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
DECLARE @Response nvarchar(MAX) DECLARE @StatusCode int DECLARE @StatusDescription nvarchar(MAX) EXEC usp_GravityForms_Entries_Fetch @Profile = 'My GravityForms', @FormID = 4, @PageSize = 3, @Offset = 0, @Response = @Response OUTPUT, @StatusCode = @StatusCode OUTPUT, @StatusDescription = @StatusDescription OUTPUT IF @StatusCode >= 400 EXEC SQLHTTP.net.RaiseHttpError @StatusCode, @StatusDescription, @Response ELSE BEGIN EXEC SQLHTTP.net.Json_To_GlobalTable @JSON = @Response, @GlobalTableName = 'GravityFormEntriesTempGlobalTable', @SuppressMessage = 1 SELECT entries_id, entries_ip, entries_date_created, entries_1, entries_2, entries_3 FROM ##GravityFormEntriesTempGlobalTable WHERE NodePath LIKE 'NoName/response{1}/entries{1}/%' ORDER BY RowID DROP TABLE ##GravityFormEntriesTempGlobalTable END |
1 2 3 4 5 6 |
entries_id entries_ip entries_date_created entries_1 entries_2 entries_3 ------------- ---------------- ----------------------- ------------- ------------- -------------- 1 106.203.66.25 2018-01-22 14:13:20 John Doe 212-555-1212 2 73.244.133.32 2018-01-20 23:14:15 Jane Doe 212-444-4444 |
IMPORTANT DISCLAIMER
CODE/SQL ON THESE PAGES ARE PROVIDED AS-IS AND ARE AVAILABLE FOR ILLUSTRATIVE PURPOSES ONLY.
USERS ARE REQUIRED TO ABIDE BY THE TERMS AND CONDITIONS FOR USING REFERENCED THIRD PARTY WEBSITES AND/OR APIs FROM THEIR RESPECTIVE WEBSITES. WE DO NOT CONDONE ANY VIOLATION OF THIRD PARTY WEBSITES AND/OR APIs TERMS AND CONDITIONS USING OUR SOFTWARE.
USERS SHALL BE SOLELY RESPONSIBLE AND BE SOLELY LIABLE FOR VIOLATION OF ANY RULES SPECIFIED BY THIRD PARTIES FOR USING THEIR WEBSITES AND/OR APIs, OR INFRINGEMENT OF RIGHTS OF SUCH THIRD PARTIES.