Reputation: 36280
Is there a way to get the shortened t.co url from the API? I need to shorted a url before posting tweet via API. How should I do this? Is this supported by Twitter API or do I have to use some other url shortener like bit.ly?
Upvotes: 24
Views: 15924
Reputation: 73
The Twitter API will pretty much shorten any link you post through it as long as it is longer than the “short_url_length” value. To answer your question, no you can't get a t.co shortened url before actually posting the tweet. But if all you need is to know the length of the t.co link, you can get the day's value of “short_url_length” (+1 for https links) from their REST API https://dev.twitter.com/rest/reference/get/help/configuration
Upvotes: 0
Reputation: 12252
Looks like all URLs are now shortened with t.co
See this post on Twitter Developers
Upvotes: 0
Reputation: 15270
It isn't possible to shorten links using t.co through any means other than sending status updates or direct messages via Twitter. From the Twitter support site:
The link service at http://t.co is only used on links posted on Twitter and is not available as a general shortening service.
So, yes, you'll need to use some other shortening service.
Upvotes: 18