2

Is there an API call where you can get all achievements and all unread achievements?

Like this:

Update

Thanks to the answer of Glorfindel, I use the following methods to calculate the unread achievements.

Note: I'm using angular 8

notification.service.ts

public getAchievements(options?: IQuestionOptions): Observable<IResponse> {   
  const headers = new HttpHeaders()
    .set('Accept', '*/*');

  const params = new HttpParams()
    .set('key', {{APP_KEY}})
    .set('access_token', {{TOKEN}})
    .set('pageSize', '30')
    .set('page', '1')
    .set('filter', 'O5lYbEN2lExNfdp2Q');

  return this.http
    .get<IResponse>(
      'https://api.stackexchange.com/2.3/', 
      { headers, params }
    );
}

Counting unread items

public countUnread(items: any): number {
  if (!items) {
    return 0;
  }

  return items
    .map(item => item.is_unread ?
      item.reputation_change ?
        item.reputation_change
        : 1
      : 0)
    .reduce((accumulator, currentValue) => accumulator + currentValue);
}

Also to be mentioned is that this method is used for counting unread messages and unread achievements, depending on what was handed over.

1 Answer 1

1
2
  • I also came across this question but this has not been answered for over 5 years. And is there a way to figure out how / where the 'Stack Exchange mobile apps' get the value for changed reputations? Commented Nov 22, 2019 at 14:39
  • I found the API method and from my tests you should be able to make it work. More details are in the linked question. Commented Nov 22, 2019 at 18:31

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.