Created
March 28, 2017 09:08
-
-
Save katydorjee/e083c31374ed20e1ee19c66da738d448 to your computer and use it in GitHub Desktop.
Bitly API to Shorten the URL in Ampscript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %%[ | |
| SET @query = "i love momo" | |
| SET @URL = TRIM(HTTPGet(Concat("https://api-ssl.bitly.com/v3/shorten?access_token=<Access Token>&format=txt&longUrl=https%3A%2F%2Fwww.google.com/#q=",@query))) | |
| ]%% | |
| %%=v(@URL)=%% | |
| <!-- | |
| Note: You need to create Bitly account and get the 'Access Token' | |
| https://bitly.com | |
| --> |
Author
Hi @katydorjee! I need your help
I'm trying to create a short url but with the new version (v4)
Should I replace like this:???
%%[
SET @query = "i love momo"
SET @url = TRIM(HTTPGet(Concat("https://api-ssl.bitly.com/v4/shorten?access_token=&format=txt&longUrl=https%3A%2F%2Fwww.google.com/#q=",@query)))
]%%
%%=v(@url)=%%
Thank you
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is the version 4 bitly URL shorter API
POST /v4/shorten HTTP/1.1
Host: api-ssl.bitly.com
Authorization: Bearer < access_token>
Content-Type: application/json
Content-Length: 123
{ "group_guid": "Bj2i6uFEYQK", "domain": "bit.ly", "long_url": "https://www.google.com/search?q=i+love+momo/" }