# Query format

# API

🚦 Note

Only 'GET' requests are handled in order to integrate with badges.

# API endpoint

https://api.spencerwoo.com/substats/

# Query string

Simple query string:

GET /?source={SOURCE}&queryKey={QUERY}

Query string shorthand with multiple services and single query (Good for RSS links):

GET /?source={SOURCE_1}|{SOURCE_2}|{SOURCE_3}&queryKey={QUERY}

Multiple { source: queryKey } combination:

GET /?source={SOURCE}&queryKey={QUERY}&source={SOURCE}&queryKey={QUERY}&source={SOURCE}&queryKey={QUERY} ....

List sequence is preserved!

# Examples

# Single query

You can make a single query to request your RSS subscribers on Feedly. (Inoreader support is coming!)

GET /?source=feedly&queryKey=https://blog.spencerwoo.com/posts/index.xml

Which returns:

{ "status": 200, "data": { "totalSubs": 13, "subsInEachSource": { "feedly": 13 }, "failedSources": {} } }

You can then use the numbers in data.totalSubs in a dynamic badge:

(opens new window)

# Multiple sources with a single query string

GET /?source=feedly|inoreader|newsblur&queryKey=https://blog.spencerwoo.com/posts/index.xml

Which returns:

{
  "status": 200,
  "data": {
    "totalSubs": 49,
    "subsInEachSource": {
      "feedly": 17,
      "inoreader": 29,
      "newsblur": 3
    },
    "failedSources": {}
  }
}

Enter the badge! (NewsBlur is quite slow, be patient.)

(opens new window)

# Multiple queries

GET /?source=telegram&queryKey=realSpencerWoo&source=sspai&queryKey=spencerwoo&source=twitter&queryKey=realSpencerWoo

Which returns:

{
  "status": 200,
  "data": {
    "totalSubs": 1552,
    "subsInEachSource": {
      "telegram": 786,
      "sspai": 638,
      "twitter": 128
    },
    "failedSources": {}
  }
}

And of course, our badges!

(opens new window) (opens new window) (opens new window) (opens new window)

Last Updated: 11/22/2020, 7:41:04 AM