View on GitHub

spas

Super Proxy Asset Server

Download this project as a .zip file Download this project as a tar.gz file

Use Your Bundle

Your bundle can be reached at

http://yourDomain.com/yourBundleName
- or -
http://yourBundleName.yourDomain.com

If you are using JSONP, just add a callback param:
http://yourBundleName.yourDomain.com?callback=doSomething

Each API response object is stored in the bundle response object whose key is the name you gave your corresponding API request object. For example:

{
  expires: "2012-11-27T01:52:20.543z",
  searchTweets: {...},
  searchMoreTweets: {...},
  secleft: 15,
  fromcache: true
}

expires: The date and time that the bundle will expire per the spas server clock. The bundle expiration is equal to the expiration of the first API response object to expire
secleft: (seconds) — Seconds until the bundle expires
fromcache: Indicates if the bundle was loaded from the spas cache or was generated on demand

Let's dig a little deeper and look at the API response objects:

{
  expires: "2012-11-27T02:17:46.045z",
  searchTweets: {
    expires: "2012-11-27T02:17:46.045z",
    result: {...},
    cname: "searchTweets",
    scheduled: true,
    fromcache: true
  },
  searchMoreTweets: {
    expires: "2012-11-27T02:18:18.343z",
    result: {...},
    cname: "searchMoreTweets"
  },
  secleft: 27,
  fromcache: true
}

expires: The date and time that the bundle part will expire. If this is the first bundle part to expire, then this will equal the bundle.expires value. Otherwise it will be greater
result: This is exactly what you would have received had you made the request directly to the Twitter API, minus the stuff that was cast off with the filter parameter of course
cname: A convenience property that is equal to your bundle parts' key
scheduled: If true, this API response was generated by a scheduled request to the API server, not on demand to fulfill a user's request
fromcache: If true, this API response was pulled from the redis cache and not generated on demand
timeout: If true, the request to the API server took longer than the timeout value set in the API request object and the cached API response was used. spas will trigger a second, asynchronous request to the API server for use next time the bundle is requested.

Next: Tips and Tricks