Skip to content
This repository has been archived by the owner on Jun 23, 2021. It is now read-only.

ArticleSearch

dustineichler edited this page Jan 19, 2012 · 5 revisions

With the Article Search API, you can search New York Times articles from 1981 to today, retrieving headlines, abstracts, lead paragraphs, links to associated multimedia and other article metadata.


Example

    NYTimesWrapper *nytimes = [[NYTimesWrapper alloc] initWithAPIKey:ARTICLE_API_KEY];
    /**
     Required
     */
    [nytimes setQuery:@"Hackday"];
    [nytimes setApiKey:ARTICLE_API_KEY];
    /**
     Optional
     */
    [nytimes setStartDate:@"20110102"];
    [nytimes setEndDate:@"20110202"];
    [nytimes setFacets:@"Facet1, Facet2, Facet3"];
    [nytimes setFields:@"Fields1, Fields2, Fields3"];
    [nytimes setOffset:@"1"];
    [nytimes setRank:@"OLDEST"];
    [nytimes setFormat:@"JSON"];
    
    [NYTimesArticle asyncRequest:nytimes 
                         success:^(NSData *data, NSURLResponse *response){
                             NSLog(@"Success!");
                         }failure:^(NSData *data, NSError *error){
                             NSLog(@"Errors %@", error);
                         } tag:@"articles"];