Skip to main content

SearchService

A list of all methods in the SearchService service. Click on the method name to view detailed information about that method.

MethodsDescription
get_articlesearch_jsonSearch for NYT articles by keywords, filters and facets.

get_articlesearch_json

Search for NYT articles by keywords, filters and facets.

  • HTTP Method: GET
  • Endpoint: /articlesearch.json

Parameters

NameTypeRequiredDescription
begin_datestrBegin date (e.g. 20120101)
end_datestrEnd date (e.g. 20121231)
facetFacetWhether to show facet counts
facet_fieldsFacetFieldsFacets
facet_filterFacetFilterHave facet counts use filters
flstrField list
fqstrFilter query
pageintPage number (0, 1, ...)
qstrQuery
sortSortSort order

Return Type

GetArticlesearchJsonOkResponse

Example Usage Code Snippet

from nyt_article_search import NytArticleSearch, Environment
from nyt_article_search.models import Facet, FacetFields, FacetFilter, Sort

sdk = NytArticleSearch(api_key="YOUR_API_KEY", base_url=Environment.DEFAULT.value)

result = sdk.search.get_articlesearch_json(
begin_date="20220101",
end_date="20220131",
facet=Facet.FALSE,
facet_fields=FacetFields.DAY_OF_WEEK,
facet_filter=FacetFilter.FALSE,
fl="fl",
fq="fq",
page=88,
q="q",
sort=Sort.NEWEST,
)

print(result)

Build Your Own SDKs with  liblab

Build developer friendly SDKs in minutes from your APIs

Start for Free →