# Popular - mostViewed

## Example

{% code title="example.js" %}

```javascript
const { Popular } = require('nytimes-api');
const popular = new Popular('your-super-secret-api-key');

popular.mostViewed(data => console.log(data[0]);
```

{% endcode %}

### What does it do?

`mostViewed` gets the articles with the most amount of views on the New York Times' website.

The code example above, however, only displays the most viewed **article** rather than the most viewed **articles**.

## Example Response

{% code title="example-response.json" %}

```javascript
{
  "url": "https://www.nytimes.com/interactive/2019/02/15/upshot/british-irish-dialect-quiz.html",
  "adx_keywords": "English Language;Geography;Ireland;Great Britain",
  "column": "",
  "section": "The Upshot",
  "byline": "By JOSH KATZ",
  "type": "Interactive",
  "title": "The British-Irish Dialect Quiz",
  "abstract": "What does the way you speak say about where you’re from? Answer 25 questions to see your own custom dialect map.",
  "published_date": "2019-02-15",
  "source": "The New York Times",
  "id": 100000006354694,
  "asset_id": 100000006354694,
  "views": 1,
  "des_facet": ["GEOGRAPHY"],
  "org_facet": ["ENGLISH LANGUAGE"],
  "per_facet": "",
  "geo_facet": ["IRELAND", "GREAT BRITAIN"],
  "media": [
    {
      "type": "image",
      "subtype": "photo",
      "caption": null,
      "copyright": null,
      "approved_for_syndication": 0,
      "media-metadata": [Array]
    }
  ]
}

```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jsmiiith.gitbook.io/nytimes/documentation/popular-mostviewed.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
