Can anyone help me work with Rebrandly API?
(you can see the API list here: https://developers.rebrandly.com/docs
I want to shorten the URL of my dynamic page once the form is submitted.
Is it possible?
If so, is there any chance someone will explain to me how?
Here is an example from their site how to use:
let linkRequest = {
destination: "https://www.youtube.com/channel/UCHK4HD0ltu1-I212icLPt3g",
domain: { fullName: "rebrand.ly" }
//, slashtag: "A_NEW_SLASHTAG"
//, title: "Rebrandly YouTube channel"
}
let requestHeaders = {
"Content-Type": "application/json",
"apikey": "YOUR_API_KEY",
"workspace": "YOUR_WORKSPACE_ID"
}
$.ajax({
url: "https://api.rebrandly.com/v1/links",
type: "post",
data: JSON.stringify(linkRequest),
headers: requestHeaders,
dataType: "json",
success: (link) => {
console.log(`Long URL was ${link.destination}, short URL is ${link.shortUrl}`);
}
});
Thank you !
but i don’t know how to start.
i got this link: https://api.rebrandly.com/v1/links/new?apikey=10bfe993153c47128e7335484a4527b5&domain[fullName]=2sell.net&destination=https://www.iwix.co.il/blank-2&slashtag=iwix
that gives me this information:
{"id":"6bf8bc6b72c5466e8f78c3cb8034a13a","title":"Link iwix","slashtag":"iwix","destination":"https://www.iwix.co.il/blank-2","createdAt":"2020-03-02T16:06:20.000Z","updatedAt":"2020-03-02T16:06:20.000Z","status":"active","tags":[],"clicks":0,"isPublic":false,"shortUrl":"2sell.net/iwix","domainId":"450055e9c767477991ab738520855661","domainName":"2sell.net","domain":{"id":"450055e9c767477991ab738520855661","ref":"/domains/450055e9c767477991ab738520855661","fullName":"2sell.net","active":true},"https":true,"favourite":false,"creator":{"id":"740c5c361b9d4c6883ac8a87754c3177","fullName":"iwix","avatarUrl":"https://s.gravatar.com/avatar/379cab52f4f25c6d03bbb7ff8dddd1c5?size=80&d=retro&rating=g"},"integrated":false,"shortURL":"2sell.net/iwix"}
how can i get the shortUrl value?