2

according to the documentation, a User object has an attribute view_count, indicating the number of views of the user's profile. An example is also given there. However, when I sent a request /2.0/users/1?order=desc&sort=reputation&site=stackoverflow I got the following returned. Where is view_count?

{
  "items": [
    {
      "user_id": 1,
      "user_type": "moderator",
      "creation_date": 1217514151,
      "display_name": "Jeff Atwood",
      "profile_image": "http://www.gravatar.com/avatar/51d623f33f8b83095db84ff35e15dbe8?d=identicon&r=PG",
      "reputation": 21911,
      "reputation_change_day": 20,
      "reputation_change_week": 73,
      "reputation_change_month": 98,
      "reputation_change_quarter": 528,
      "reputation_change_year": 3122,
      "age": 41,
      "last_access_date": 1344378892,
      "last_modified_date": 1344439260,
      "is_employee": true,
      "link": "http://stackoverflow.com/users/1/jeff-atwood",
      "website_url": "http://www.codinghorror.com/blog/",
      "location": "El Cerrito, CA",
      "account_id": 1,
      "badge_counts": {
        "gold": 29,
        "silver": 97,
        "bronze": 111
      },
      "accept_rate": 100
    }
  ],
  "quota_remaining": 9985,
  "quota_max": 10000,
  "has_more": false
}

1 Answer 1

2

View count is not returned by default (see the list of default fields here). It's excluded in the default filter.

Try adding this: &filter=!9hnGsu7zN

EDIT:

The filters can be generated using the API's filter create method https://api.stackexchange.com/docs/create-filter.

Or manually using the 'default filter [edit]' drop down found on each method's docs page.

1
  • Great! And how to use other non-default filters, such as about_me or up_vote_count? Commented Aug 10, 2012 at 9:14

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.