1

Using the GetSatisfaction API, how can I get the number of community members? I want to use this number to great a GitHub shield using Shields.io.

API: https://education.getsatisfaction.com/reference-guide/api/api-resources/

There are a number of endpoints and it looks like the following People endpoint should do what I want:

GET /companies/{community_id}/people.json

But when I call this, I don't get the right figure.

For example, the homepage of the RingCentral Community says 10,035 members but the following API only returns 933 people, where 102909 is the community_id as shown in View Source of the community page.

Source excerpt:

GSFN.Authenticatable.companyId = 102909;
Grokify
  • 15,092
  • 6
  • 60
  • 81

2 Answers2

4

I just figured this out. To get this number, call the Company API directly and look for the approximate_people_count figure:

GET /companies/{community_id}.json

This will return a JSON object with the following property:

"approximate_people_count":10042

Once you have this, you can use the Shields.io uri, query, and suffix parameters as follows:

  • uri=http%3A%2F%2Fapi.getsatisfaction.com%2Fcompanies%2F102909.json
  • query=$.approximate_people_count
  • suffix=%20members (optional, shown below)

Put this together for:

https://img.shields.io/badge/dynamic/json.svg?label=community&colorB=&suffix=%20members&query=$.approximate_people_count&uri=http%3A%2F%2Fapi.getsatisfaction.com%2Fcompanies%2F102909.json

Grokify
  • 15,092
  • 6
  • 60
  • 81
2

If you don't mind using Badgen, here is the Badgen way to do that:

  1. Create a RunKit endpoint (using it's handy online editor) do the works, query json & get count result, then response a json: {subject: '', status: '', color: ''}, like https://runkit.com/amio/peoples

  2. Use https://badgen.net/runkit/:endpoint_id/:args to serve badge from that endpoint. Here's the badge url: https://badgen.net/runkit/peoples-txwpy888xiuk/102909

With Badgen you can have a cleaner url, and create badge from more complicated api source, thanks to RunKit endpoint.

Here's a full featured example: https://runkit.com/amio/satisfaction

  • https://badgen.net/runkit/satisfaction-flq08o9mm3ka/102909/employee
    
  • https://badgen.net/runkit/satisfaction-flq08o9mm3ka/102909/people
    
  • https://badgen.net/runkit/satisfaction-flq08o9mm3ka/102909/topic
    

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Amio
  • 185
  • 1
  • 5