Event - Update
Update 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 43 44 |
CREATE PROCEDURE usp_ConstantContact_v2_Event_Update( @Profile nvarchar(100), @EventID varchar(MAX), @Body 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 = 'PUT', @Body = @Body, @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 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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
DECLARE @Response nvarchar(MAX) DECLARE @StatusCode int DECLARE @StatusDescription nvarchar(MAX) DECLARE @Body varchar(MAX) SET @Body = '{ "name": "My Event - July 2017", "title": "My Brand New Event", "status": "DRAFT", "location": "The Atrium on the Wharf", "type": "CLASSES_WORKSHOPS", "address": { "city": "Anytown", "state": "Massachusetts", "country": "United States", "line1": "123 Maple Road", "state_code": "MA", "country_code": "us", "postal_code": "11111" }, "description": "Take your skills to the next level by attending these focused workshops.", "contact": { "name": "Knowshon Moreno", "email_address": "kmoreno@example.com", "phone_number": "555-555-5555", "organization_name": "The Event Organization" }, "start_date": "2017-07-03T14:00:00.000Z", "end_date": "2017-07-08T21:00:00.000Z", "time_zone_id": "US/Eastern", "is_checkin_available": false, "registration_url": "https://events.r20.l1.constantcontact.com/register/event?oeidk=a07e1iw4r2m67314717", "theme_name":"Default", "payment_address":{ "city":"My City", "line1":"1111 Broadway", "state_code":"FL", "country_code":"US", "postal_code":"11111" }, "paypal_account_email":"jdoe@example.com", "payable_to":"The Payee", "payment_options":[ "PAYPAL", "CHECK", "DOOR" ], "currency_type": "USD", "is_virtual_event": false, "notification_options": [ { "notification_type": "SO_REGISTRATION_NOTIFICATION", "is_opted_in": true } ], "is_home_page_displayed": false, "is_map_displayed": true, "is_calendar_displayed": true, "is_listed_in_external_directory": false, "are_registrants_public": false, "track_information": { "information_sections": [ "CONTACT", "TIME", "LOCATION" ], "is_registration_closed_manually": false, "is_ticketing_link_displayed": false, "guest_limit": 0, "registration_limit_count": 0, "guest_display_label": "Guest(s)", "is_guest_name_required": false, "is_guest_anonymous_enabled": false } }' EXEC usp_ConstantContact_v2_Event_Update @Profile = 'My ConstantContact', @EventID = 'a07eec4nec6c5484c67', @Body = @Body, @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'@start_date', N'nvarchar(MAX)') AS [start_date] ,T.C.value(N'@paypal_account_email', N'nvarchar(MAX)') AS [paypal_account_email] FROM @X.nodes(N'/JsonObject') T(C) END |
1 2 3 4 5 |
id name start_date paypal_account_email -------------------- --------------------- ------------------------- --------------------- a07eec4nec6c5484c67 My Event - July 2017 2017-07-03T14:00:00.000Z jdoe@example.com |
- 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.