Can we have the people reached statistic added to the /users/{ids}
method?
The response could simply be:
"people_reached": 1000
I'm asking because it would be cool to get a network-wide number.
Can we have the people reached statistic added to the /users/{ids}
method?
The response could simply be:
"people_reached": 1000
I'm asking because it would be cool to get a network-wide number.
Until the feature request is approved (unlikely, and a similar request has no developer love either), you can get this number in one of 3 ways:
You can get slightly stale data with this SEDE query (Not mine, and may not reflect SE's algorithm as of 2018).
Note that it uses your Stack Exchange account number (4337810 for the OP) -- which you can get by clicking on the "Accounts" listing of any profile page.
Or, You can make a boatload of API calls to get the current information. See the pseudocode, below.
Or, You can just scrape all of the user's account profile pages, extracting and summing the people reached stat.
Recipe for calculating network people reached using the API:
Set variable helpfulViews
to zero.
With the user's SE id, call /users/{ids}/associated
. For example:
/2.2/users/4337810/associated?pagesize=100&filter=!Snjr*CId4V6czluxxf
Discard any returned sites that have question_count == 0
AND answer_count == 0
.
For each of the remaining site accounts:
site_url
. This will be passed as the site parameter.user_id
for that site, call /users/{ids}/questions
. For example:Loop through the returned questions, adding the view_count
s to helpfulViews
. But discard any question that has closed_date
set.
Now, call /users/{ids}/answers
. For example:
/users/74948/answers?pagesize=100&site=webapps.stackexchange.com&filter=!.UE8F0rlDSTV0*VE
ansMetrics
to an empty array of objects.For each answer:
answer_id
, the question_id
, the score
, and the is_accepted
value. Add that object to the to ansMetrics
array.Now, collect the question_id
s, from ansMetrics
into batches of 100.
For each batch, call /questions/{ids}
. For example:
/2.2/questions/65674;67758?pagesize=100&site=webapps.stackexchange.com&filter=!l83g-Uitq5r7FkUIAdfApf
For each question returned:
answer_id
from the ansMetrics
object.is_accepted
== true
, then add the question's view_count
to helpfulViews
.score
> 5
, then add the question's view_count
to helpfulViews
.view_count
to helpfulViews
.view_count
to helpfulViews
.helpfulViews
will be the people reached score.items
? I have replaced site as stackoverflow.com
Commented
Nov 4, 2020 at 5:43
stackoverflow.com
in the above queries and it does not return any item
Commented
Nov 4, 2020 at 5:45
Invalid filter specified
. You could try generating the filter string again and retrying