Event - Fetch
Retrieve an existing event using SQL Server
- See SQLHTTP easy setup for Constant Contact
- 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 |
CREATE PROCEDURE usp_ConstantContact_v2_Event_Fetch( @Profile nvarchar(100), @EventID varchar(MAX), @Response nvarchar(MAX) OUTPUT, @StatusCode int OUTPUT, @StatusDescription nvarchar(MAX) OUTPUT) AS SET NOCOUNT ON DECLARE @URL varchar(MAX) DECLARE @QueryString varchar(MAX) DECLARE @HTTPSessionID uniqueidentifier SET @URL = 'https://api.constantcontact.com/v2' EXEC SQLHTTP.net.UrlBuilder @URL OUTPUT, @Profile, 'eventspot','events',@EventID EXEC SQLHTTP.net.QueryStringBuilder @QueryString OUTPUT, @Profile, 'api_key', '#APIKey' SET @URL = @URL + @QueryString EXEC SQLHTTP.net.HTTPSession @HTTPSessionID OUTPUT EXEC usp_ConstantContact_v2_Auth_Header @Profile, @HTTPSessionID EXEC SQLHTTP.net.HTTPRequest @HttpSessionID, @URL = @URL, @Method = 'GET', @ContentType = 'application/json', @StatusCode = @StatusCode OUTPUT, @StatusDescription = @StatusDescription OUTPUT, @Response = @Response 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 34 |
DECLARE @Response nvarchar(MAX) DECLARE @StatusCode int DECLARE @StatusDescription nvarchar(MAX) EXEC usp_ConstantContact_v2_Event_Fetch @Profile = 'My ConstantContact', @EventID = 'a07eec4nec6c5484c67', @Response = @Response OUTPUT, @StatusCode = @StatusCode OUTPUT, @StatusDescription = @StatusDescription OUTPUT IF @StatusCode >= 400 --An HTTP Request error has occured EXEC SQLHTTP.net.RaiseHttpError @StatusCode, @StatusDescription, @Response ELSE BEGIN DECLARE @X xml SET @X = SQLHTTP.net.Json_To_Xml(@Response, '0') --The XPath syntax below was easily generated by executing the following commands: --EXEC SQLHTTP.net.XQueryHelper @X --and then executing: --EXEC SQLHTTP.net.XQueryHelper @X, 'JsonObject' SELECT T.C.value(N'@id', N'nvarchar(MAX)') AS [id] ,T.C.value(N'@name', N'nvarchar(MAX)') AS [name] ,T.C.value(N'@title', N'nvarchar(MAX)') AS [title] ,T.C.value(N'@status', N'nvarchar(MAX)') AS [status] FROM @X.nodes(N'/JsonObject') T(C) END |
1 2 3 4 5 |
id name title status -------------------- --------------------- ------------------- ----------- a07eec4nec6c5484c67 My Event - July 2017 My Brand New Event DRAFT |
- Account Info – Fetch
- Account Info – Update
- Account Verified-Email-Address – Create
- Account Verified-Email-Addresses – Fetch
- Contact – Create
- Contact – Fetch
- Contact – Unsubscribe
- Contact List – Create
- Contact List – Delete
- Contact List – Fetch
- Contact List – Update
- Contact Lists – Fetch
- Contacts – Fetch
- Email-Marketing Campaign – Create
- Email-Marketing Campaign – Delete
- Email-Marketing Campaign – Fetch
- Email-Marketing Campaign – Preview
- Email-Marketing Campaign – Update
- Email-Marketing Campaign Schedule – Create
- Email-Marketing Campaign Test – Create
- Email-Marketing Campaigns – Fetch
- Event – Create
- Event – Fetch
- Event – Patch
- Event – Update
- Event Fee – Create
- Event Fee – Delete
- Event Fee – Fetch
- Event Fee – Update
- Event Fees – Fetch
- Event Item – Create
- Event Item – Delete
- Event Item – Fetch
- Event Item – Update
- Event Item Attribute – Create
- Event Item Attribute – Delete
- Event Item Attribute – Fetch
- Event Item Attribute – Update
- Event Item Attributes – Fetch
- Event Items – Fetch
- Event Promocode – Create
- Event Promocode – Delete
- Event Promocode – Fetch
- Event Promocode – Update
- Event Promocodes – Fetch
- Event Registrant – Fetch
- Event Registrants – Fetch
- Events – Fetch
- Library File – Delete
- Library File Upload-Status – Fetch
- Library Files – Move
- Library Folder – Create
- Library Folder – Delete
- Library Folder – Fetch
- Library Folder – Update
- Library Folders Trash Files – Delete
- Library Info – Fetch
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.