Connecting to Bitly
The Bitly API uses API Key authentication (Bearer token).
Using API Key Authentication
Your Bitly Access Token is required to create a connection to Bitly. To obtain an access token, log in to your Bitly account at https://bitly.com, navigate to Settings > Developer Settings, and click "Generate Access Token". Once you have obtained it, set it in the ProfileSettings connection property.
Example Connection string
Profile=C:\profiles\Bitly.apip;ProfileSettings='APIKey=your_access_token;';AuthScheme=APIKey;
Usage Examples
BitlinkCities:
SELECT * FROM BitlinkCities WHERE Bitlink = 'bit.ly/example'
BitlinkClicks:
SELECT * FROM BitlinkClicks WHERE Bitlink = 'bit.ly/example'
BitlinkClicksSummary:
SELECT * FROM BitlinkClicksSummary WHERE Bitlink = 'bit.ly/example'
BitlinkCountries:
SELECT * FROM BitlinkCountries WHERE Bitlink = 'bit.ly/example'
BitlinkDevices:
SELECT * FROM BitlinkDevices WHERE Bitlink = 'bit.ly/example'
BitlinkReferrers:
SELECT * FROM BitlinkReferrers WHERE Bitlink = 'bit.ly/example'
BitlinkReferrersByDomains:
SELECT * FROM BitlinkReferrersByDomains WHERE Bitlink = 'bit.ly/example'
BitlinkReferringDomains:
SELECT * FROM BitlinkReferringDomains WHERE Bitlink = 'bit.ly/example'
BSDs:
SELECT * FROM BSDs
Campaigns:
SELECT * FROM Campaigns
INSERT INTO Campaigns (Name, GroupGuid, Description) VALUES ('Q4 Holiday Campaign', 'Ba1bc23dE4F', 'Campaign for holiday promotions')
UPDATE Campaigns SET Name = 'Q4 Holiday Campaign Updated', Description = 'Updated campaign details' WHERE Guid = 'Ca2de34fG5H'
Channels:
SELECT * FROM Channels
INSERT INTO Channels (Name, GroupGuid) VALUES ('Social Media Channel', 'Ba1bc23dE4F')
UPDATE Channels SET Name = 'Social Media Channel Updated' WHERE Guid = 'Ch1ab23cD4E'
CustomBitlink:
SELECT * FROM CustomBitlink WHERE CustomBitlink = 'brand.co/example'
CustomBitlinkClicks:
SELECT * FROM CustomBitlinkClicks WHERE CustomBitlink = 'brand.co/example'
CustomBitlinkClicksByDestination:
SELECT * FROM CustomBitlinkClicksByDestination WHERE CustomBitlink = 'brand.co/example'
GroupBitlinks:
SELECT * FROM GroupBitlinks WHERE GroupGuid = 'Ba1bc23dE4F'
INSERT INTO GroupBitlinks (LongUrl, Title, Tags, GroupGuid) VALUES ('https://www.example.com/my-long-url', 'My Campaign Link', '["marketing","social"]', 'Ba1bc23dE4F')
UPDATE GroupBitlinks SET Title = 'Updated Campaign Link', IsArchived = false, LongUrl = 'https://www.example.com/updated-url', Tags = '["marketing","email"]' WHERE Id = 'bit.ly/4xFZhre'
DELETE FROM GroupBitlinks WHERE Id = 'bit.ly/4xFZhre'
GroupCities:
SELECT * FROM GroupCities WHERE GroupGuid = 'Ba1bc23dE4F'
GroupClicks:
SELECT * FROM GroupClicks WHERE GroupGuid = 'Ba1bc23dE4F'
GroupCountries:
SELECT * FROM GroupCountries WHERE GroupGuid = 'Ba1bc23dE4F'
GroupDevices:
SELECT * FROM GroupDevices WHERE GroupGuid = 'Ba1bc23dE4F'
GroupLinkClicksOverTime:
SELECT * FROM GroupLinkClicksOverTime WHERE GroupGuid = 'Ba1bc23dE4F'
GroupMetricsOverTime:
SELECT * FROM GroupMetricsOverTime WHERE GroupGuid = 'Ba1bc23dE4F'
GroupReferrers:
SELECT * FROM GroupReferrers WHERE GroupGuid = 'Ba1bc23dE4F'
GroupReferringNetworks:
SELECT * FROM GroupReferringNetworks WHERE GroupGuid = 'Ba1bc23dE4F'
Groups:
SELECT * FROM Groups
UPDATE Groups SET Name = 'Marketing Team', OrganizationGuid = 'Oa1bc23dE4F', Bsds = '["brand.co"]' WHERE Guid = 'Ba1bc23dE4F'
GroupShortenCounts:
SELECT * FROM GroupShortenCounts WHERE GroupGuid = 'Ba1bc23dE4F'
GroupTopEngagement:
SELECT * FROM GroupTopEngagement WHERE GroupGuid = 'Ba1bc23dE4F'
GroupTopLinkClicks:
SELECT * FROM GroupTopLinkClicks WHERE GroupGuid = 'Ba1bc23dE4F'
Organizations:
SELECT * FROM Organizations
QRCodes:
SELECT * FROM QRCodes WHERE GroupGuid = 'Ba1bc23dE4F'
INSERT INTO QRCodes (GroupGuid, BitlinkId, Title, IsArchived) VALUES ('Ba1bc23dE4F', 'bit.ly/4xFZhre', 'Store Entrance QR', false)
UPDATE QRCodes SET Title = 'Store Entrance QR Updated', IsArchived = false WHERE QrcodeId = 'qr-code-id-123'
QRCodeScans:
SELECT * FROM QRCodeScans WHERE QrcodeId = 'qr-code-id-123'
QRCodeScansCities:
SELECT * FROM QRCodeScansCities WHERE QrcodeId = 'qr-code-id-123'
QRCodeScansCountries:
SELECT * FROM QRCodeScansCountries WHERE QrcodeId = 'qr-code-id-123'
QRCodeScansSummary:
SELECT * FROM QRCodeScansSummary WHERE QrcodeId = 'qr-code-id-123'
Users:
SELECT * FROM Users
UPDATE Users SET Name = 'Jane Smith'
Connection Properties
The connection string properties are the various options that can be used to establish a connection. This section provides a complete list of the options you can configure in the connection string for this provider.
| Property | Description |
| APIKey | The API key used for authentication with the Bitly API. |
| AuthScheme | The scheme used for authentication. Accepted entries are APIKey or None. Allowed values are: BASIC, NONE, NTLM, OAUTH, APIKEY, OAUTH_CLIENT, OAUTH_PASSWORD |