'How to get the number of people in a GetSatisfaction community for Shields.io?
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.
- API URL: http://api.getsatisfaction.com/companies/102909/people.json
- Web page URL: https://devcommunity.ringcentral.com
Source excerpt:
GSFN.Authenticatable.companyId = 102909;
Solution 1:[1]
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.jsonquery=$.approximate_people_countsuffix=%20members(optional, shown below)
Put this together for:
Solution 2:[2]
If you don't mind using Badgen, here is the Badgen way to do that:
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/peoplesUse
https://badgen.net/runkit/:endpoint_id/:argsto 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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Glorfindel |
