Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 14

A tip for developers working with the Stack Exchange API.

13 votes
0 answers
15k views

How to call the API via JSONP in Plain Old JavaScript

This tips demonstrates how to call the API in JavaScript without the need of jQuery or other frameworks. In a lot of cases you will find that the JSONP implementations provided in various frameworks …
9 votes
7 answers
4k views

How to format time since xxx e.g. "4 minutes ago" similar to Stack Exchange sites

function timeSince(date) { var seconds = Math.floor((new Date() - date) / 1000); var interval = Math.floor(seconds / 31536000); if (interval > 1) { return interval + " years"; …
7 votes
0 answers
478 views

How to use min/max with sort

While some sort values make inference of the expected min/max values less than ambiguous, others do not. Pending formal documentation, I hope this can serve as an informal reference. Aggregated sort …
6 votes
0 answers
177 views

How to get the count of a query efficiently

To get the count of a query without returning results, simply specify pagesize=0. http://api.stackoverflow.com/0.9/users?filter=mike&sort=name&pagesize=0 { "total": 1161, "page": 1, "pagesize" …
5 votes
2 answers
174 views

Simple Activity Monitor - For Educational Purposes only.

This Soapi.JS script, if abused is likely to provoke frowns from those whom you would like to see smiles. Note: the dataset is only valid if the entire user base is pulled, and on just about any othe …
5 votes
2 answers
2k views

API compliant request throttle implementations

Balancing compliance with Request Throttling Limits with maximum allowable throughput in our applications and libraries with any reliability requires self-throttling. This post is meant to be a repo …
4 votes

How to format reputation numbers similar to Stack Exchange sites

c# Rounds up - same same SO. public string FormatReputation(int value) { var rep = System.Convert.ToDouble(value); if (rep < 10000) { return rep.ToString("N0"); } …
Sky Sanders's user avatar
  • 12.1k
4 votes
0 answers
1k views

Dev-Tip: How to call the API in C# and Silverlight

This tip shows a simple and reliable way to create HttpWebRequest that are configured to properly query the api. With the exception of the AutomaticDecompression assignment, this code can be used in …
Sky Sanders's user avatar
  • 12.1k
4 votes
0 answers
874 views

How to retrieve paged API results in C# and Silverlight

In this tip we are going to leverage the SimpleRequestFactory and gather a multipage response. Let's pull the first 5 pages of 100 users on stackapps.com. NOTE: for Silverlight, substitute Newtonsoft. …
4 votes
8 answers
4k views

How to format reputation numbers similar to Stack Exchange sites

UPDATE For JavaScript, see CMS's implementation below. It is much more elegant than the one I provide in the body of this Q. // formats a number similar to the way stack exchange sites / …
4 votes
0 answers
74 views

recommended buffer size for markdown fields is conservative

I ran into a truncation error while inserting user data into a database using the documented field length (buffer size) of 3000. So I redefined to nvarchar(max), pulled all users in the stack exchang …
3 votes
Accepted

How to format an url-friendly slug for question urls

the 'slug' is a cleaned title hyphen delimited and truncated to some length which is easily discoverable by measuring a few 'slugs' that are obviously truncated. and in reality, you can place any th …
Sky Sanders's user avatar
  • 12.1k
3 votes

Should we adjust the format of the dev-tip questions early on?

As I said, I like it. As usual, Steffen presents a well considered opinion and one that I agree with. The dev-tip is just something I started doing without much thought except 'hey, for those trying …
Sky Sanders's user avatar
  • 12.1k
3 votes
1 answer
99 views

How to generate a list of users ranked by bug report submissions.

The use case is to generate a list of bug report submissions, grouped by User, of the following counts in descending order: bug bug + status-completed bug + status-deferred bug + status-bydesign …
3 votes
2 answers
107 views

How to calculate a list of users ranked by question view count totals.

The API provides methods to sort and filter individual questions by view count. In order to calculate the question view count totals per User, some grouping and set operations are required. e.g. t …

15 30 50 per page