nytimes-api
  • Welcome!
  • Documentation
    • Popular - mostEmailed
    • Popular - mostViewed
    • Popular - mostShared
    • Movies - allCritics
    • Movies - criticsPick
    • Movies - searchCritics
    • Movies - searchReviews
    • Books - bestSellersLists
    • Books - bestSellers
    • Books - overview
    • Books - searchReviews
    • TopStories - sections
    • TopStories - randomSection
    • TopStories - topStories
  • Examples
  • Changelogs
    • 1.0
    • 1.1
    • 1.2
    • 1.2.1
    • 1.3
Powered by GitBook
On this page
  • Example
  • What does it do?
  • Example Response
  1. Documentation

TopStories - sections

Example

example.js
const { TopStories } = require('nytimes-api');
const top = new TopStories('your-super-secret-api-key');

top.sections(data => console.log(data));

What does it do?

sections returns an array full of all of the sections you can search for top stories for. The code example above does the same.

This is not a feature in the API. It has just been added to the wrapper for convenience.

Example Response

example-response.json
[ 'arts',
  'automobiles',
  'books',
  'business',
  'fashion',
  'food',
  'health',
  'home',
  'insider',
  'magazine',
  'movies',
  'national',
  'nyregion',
  'obituaries',
  'opinion',
  'politics',
  'realestate',
  'science',
  'sports',
  'sundayreview',
  'technology',
  'theater',
  'tmagazine',
  'travel',
  'upshot',
  'world' ]
PreviousBooks - searchReviewsNextTopStories - randomSection

Last updated 6 years ago