Interact with the Twitter API using SQL Server
- Install the SQLHTTP database on your SQL Server
- Obtain a Consumer Key, Consumer Secret, Token and Token Secret from dev.twitter.com
- Create the stored procedures documented below
- Execute the following SQL statement:
1 2 3 4 5 6 7 |
EXEC usp_Twitter_Auth_Init @Profile = 'enter-profile-name-of-your-choosing', @ConsumerKey = 'your-twitter-consumer-key', @ConsumerSecret = 'your-twitter-consumer-secret', @Token = 'your-twitter-token-here', @TokenSecret = 'your-twitter-token-secret' |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
CREATE PROCEDURE usp_Twitter_Auth_Init( @Profile nvarchar(100), @ConsumerKey varchar(4000), @ConsumerSecret varchar(4000), @Token varchar(4000), @TokenSecret varchar(4000)) AS EXEC SQLHTTP.net.AuthParamSet @Profile = @Profile, @Name = 'ConsumerKey', @Value = @ConsumerKey EXEC SQLHTTP.net.AuthParamSet @Profile = @Profile, @Name = 'ConsumerSecret', @Value = @ConsumerSecret EXEC SQLHTTP.net.AuthParamSet @Profile = @Profile, @Name = 'Token', @Value = @Token EXEC SQLHTTP.net.AuthParamSet @Profile = @Profile, @Name = 'TokenSecret', @Value = @TokenSecret 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 |
CREATE PROCEDURE usp_Twitter_Auth_Header( @Profile nvarchar(100), @HttpSessionID uniqueidentifier, @URL varchar(4000), @Method varchar(10)) AS DECLARE @ConsumerKey varchar(4000) DECLARE @ConsumerSecret varchar(4000) DECLARE @Token varchar(4000) DECLARE @TokenSecret varchar(4000) DECLARE @RealmID bigint SET @ConsumerKey = SQLHTTP.net.AuthParam(@Profile, 'ConsumerKey') SET @ConsumerSecret = SQLHTTP.net.AuthParam(@Profile, 'ConsumerSecret') SET @Token = SQLHTTP.net.AuthParam(@Profile, 'Token') SET @TokenSecret = SQLHTTP.net.AuthParam(@Profile, 'TokenSecret') EXEC SQLHTTP.net.OAuthHeader @HttpSessionID = @HttpSessionID, @URL = @URL, @Method = @Method, @ConsumerKey = @ConsumerKey, @ConsumerSecret = @ConsumerSecret, @Token = @Token, @TokenSecret = @TokenSecret GO |
- Account Credentials – Verify
- Account Profile – Update
- Account Profile Banner – Remove
- Account Settings – Fetch
- Account Settings – Update
- Direct Message – Delete
- Direct Message – Fetch
- Direct Message – Send
- Direct Message Event – Create
- Direct Message Event – Fetch
- Direct Message Events – Fetch
- Direct Messages – Fetch
- Direct Messages Sent – Fetch
- Favorite – Create
- Favorite – Destroy
- Favorites – Fetch
- Followers (IDs) – Fetch
- Followers – Fetch
- Followers Pending (IDs) – Fetch
- Friends (IDs) – Fetch
- Friends – Fetch
- Friends Pending (IDs) – Fetch
- Friendship – Create
- Friendship – Destroy
- Friendship – Update
- Friendships (My)- Fetch
- Friendships – Fetch
- Friendships No Retweet Users (IDs) – Fetch
- Home – Fetch
- List – Create
- List – Delete
- List – Fetch
- List – Update
- List Member – Create
- List Member – Fetch
- List Member – Remove
- List Members – Create
- List Members – Fetch
- List Members – Remove
- List Subscriber – Create
- List Subscriber – Delete
- List Subscriber – Fetch
- List Subscribers – Fetch
- Lists Memberships – Fetch
- Lists Ownership – Fetch
- Lists Subscriptions – Fetch
- Lists- Fetch
- Mentions – Fetch
- Muted Users (IDs) – Fetch
- Place – Fetch
- Places – Search
- Places By Geocode – Fetch
- Profile Banner – Fetch
- Rate Limit Status – Fetch
- Retweet – Untweet
- Retweeters (IDs) – Fetch
- Retweets – Fetch
- Retweets of Me – Fetch
- Saved Search – Create
- Saved Search – Delete
- Saved Search – Fetch
- Saved Searches – Fetch
- Suggestion Categories – Fetch
- Suggestion Category Users – Fetch
- Trends Available Locations – Fetch
- Trends By Location – Fetch
- Tweet – Delete
- Tweet – Retweet
- Tweet By ID – Fetch
- Tweet- Create
- Tweets By List – Fetch
- Tweets By Query – Fetch
- Tweets By User – Fetch
- User – Block
- User – Fetch
- User – Mute
- User – Report As Spam
- User – Unblock
- User – Unmute
- Users (IDs) Blocked – Fetch
- Users – Fetch
- Users – Search
- Users Blocked – Fetch
- Users Muted – Fetch
- Welcome Message – Create
- Welcome Message – Delete
- Welcome Message – Fetch
- Welcome Message Rule – Delete
- Welcome Message Rule – Fetch
- Welcome Message Rules – Create
- Welcome Message Rules – Fetch
- Welcome Messages – 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.