Skip to content

Instantly share code, notes, and snippets.

@teybannerman
Last active August 22, 2018 00:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save teybannerman/9690085 to your computer and use it in GitHub Desktop.
Save teybannerman/9690085 to your computer and use it in GitHub Desktop.
AddThis Public sharing endpoints & API URL to retrieve total share count for any given URL
http://api-public.addthis.com/url/shares.json?url=http%3A%2F%2Fwww.twitter.com
Full doco at http://support.addthis.com/customer/portal/articles/381265-addthis-sharing-endpoints#.Uyxmr_l_vEd
-----------------------------------------------------------------------------------------------
EXAMPLES:
<a href="http://api.addthis.com/oexchange/0.8/forward/facebook/offer?url=http://econsultancy.com" rel="nofollow">Facebook</a>
<a href="http://api.addthis.com/oexchange/0.8/forward/twitter/offer?url=http://econsultancy.com" rel="nofollow">Twitter</a>
<a href="http://api.addthis.com/oexchange/0.8/forward/facebook/offer?url=http://econsultancy.com" rel="nofollow">G+</a>
-----------------------------------------------------------------------------------------------
ENDPOINT:
/forward/SERVICE_CODE/offer
-----------------------------------------------------------------------------------------------
PARAMETERS:
url URL of the page being shared string yes http://addthis.com
title Title of the page being shared string no AddThis Home Page
description Short description of page being shared string no Awesome page description
pubid Your publisher profile ID string no addthis
email_template Template for email share (pubid req) string no my_template
ct Enable click tracking string no ct=1
-----------------------------------------------------------------------------------------------
CUSTOMISING TWITTER SHARING:
You can customize your Twitter shares with a few extra parameters on your request (optional).
These parameters are passed through to Twitter and work as described in their web intents specification.
Optional Twitter Parameters
Name Description Example
text Text to show in the tweet, instead of the link's title. Check out this link
via A Twitter account which is appended to your tweet like: addthis
"[text] [url] via @[via]"
related Comma separated list of related twitter accounts, suggested clearspring,numbakrrunch
to the user after they tweet.
Note: To use these options you must not pass the template parameter which has been deprecated.
-----------------------------------------------------------------------------------------------
URL SHORTENING:
Providing your account details will integrate your shares with your bit.ly or awe.sm click analytics.
ShareThis will automaticallly shorten urls shared to twitter if they're longer than 40 chars. You can
request url shortening on any share using their endpoints. Simply add the shortener=bitly parameter
to your request and the shared url will be shortened with bit.ly before passing it to the destination.
You can also shorten with your own bitly account by passing these parameters:
shortener=bitly
bitly.login=<your bitly username>
bitly.apiKey=<your bitly api key>
If you have an awe.sm account you can shorten with awe.sm instead:
shortener=awesm
awesm.key=<your awesm Account API Key> (required)
-----------------------------------------------------------------------------------------------
RATE LIMITING:
Requests will be rate limited at 1000 requests/hour per ip address.
-----------------------------------------------------------------------------------------------
NOTES:
* Should always include publisher profile ID parameter for analytics purposes
as per http://support.addthis.com/customer/portal/articles/381216-using-profiles
* If using click tracking, shared page must have AddThis client code to measure clicks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment