SearchService
A list of all methods in the SearchService
service. Click on the method name to view detailed information about that method.
Methods | Description |
---|---|
get_articlesearch_json | Search 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
Name | Type | Required | Description |
---|---|---|---|
begin_date | str | ❌ | Begin date (e.g. 20120101) |
end_date | str | ❌ | End date (e.g. 20121231) |
facet | Facet | ❌ | Whether to show facet counts |
facet_fields | FacetFields | ❌ | Facets |
facet_filter | FacetFilter | ❌ | Have facet counts use filters |
fl | str | ❌ | Field list |
fq | str | ❌ | Filter query |
page | int | ❌ | Page number (0, 1, ...) |
q | str | ❌ | Query |
sort | Sort | ❌ | Sort 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