Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use the following API endpoint,</p> <pre><code>http://cdn.api.twitter.com/1/urls/count.json?url=http://stackoverflow.com </code></pre> <p><sub>Note that the <code>http://urls.api.twitter.com/</code> endpoint is <a href="https://twittercommunity.com/t/is-http-urls-api-twitter-com-1-urls-count-json-a-valid-way-to-get-the-tweet-count-for-a-url/13369" rel="nofollow"><em>not</em> public</a>.)</sub></p> <p>The endpoint will return a JSON string similar to,</p> <pre><code>{"count":27438,"url":"http:\/\/stackoverflow.com\/"} </code></pre> <p>On the client, if you are making a request to get the URL share count for your own domain (the one the script is running from), then an AJAX request will work (e.g. <a href="http://api.jquery.com/jQuery.getJSON/" rel="nofollow"><code>jQuery.getJSON</code></a>). Otherwise, issue a JSONP request by appending <code>callback=?</code>:</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>jQuery.getJSON('https://cdn.api.twitter.com/1/urls/count.json?url=http://stackoverflow.com/&amp;callback=?', function (data) { jQuery('#so-url-shares').text(data.count); });</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt; &lt;div id="so-url-shares"&gt;Calculating...&lt;/div&gt;</code></pre> </div> </div> </p> <p><strong>Update:</strong></p> <p>As of 21st November 2015, this way of getting twitter share count, does not work anymore. Read more at: <a href="https://blog.twitter.com/2015/hard-decisions-for-a-sustainable-platform" rel="nofollow">https://blog.twitter.com/2015/hard-decisions-for-a-sustainable-platform</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload