Reputation: 16334
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;
Upvotes: 1
Views: 486
Reputation: 184
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/peoples
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
Upvotes: 2
Reputation: 16334
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:
Upvotes: 4