About

The trends endpoint allows you to identify the most-mentioned entities, concepts and keywords relevant to your query. For example, this endpoint allows you to set parameters like a time period, a subject category, or an entity, and your request will return the most mentioned entities or keywords that are mentioned in relation to your query.

Parameters

Name Type Description Notes
Field string This parameter is used to specify the trend field. [enum: author.name, source.name, source.domain, keywords, entities.title.text, entities.title.type, entities.title.links.dbpedia, entities.body.text, entities.body.type, entities.body.links.dbpedia, hashtags, categories.id, sentiment.title.polarity, sentiment.body.polarity]
Id []int64 This parameter is used for finding stories by story id. [optional]
NotId []int64 This parameter is used for excluding stories by story id. [optional]
Title string This parameter is used for finding stories whose title contains a specfic keyword. It supports boolean operators. [optional]
Body string This parameter is used for finding stories whose body contains a specfic keyword. It supports boolean operators. [optional]
Text string This parameter is used for finding stories whose title or body contains a specfic keyword. It supports boolean operators. [optional]
Language []string This parameter is used for finding stories whose language is the specified value. It supports ISO 639-1 language codes. [optional] [enum: en, de, fr, it, es, pt]
NotLanguage []string This parameter is used for excluding stories whose language is the specified value. It supports ISO 639-1 language codes. [optional] [enum: en, de, fr, it, es, pt]
PublishedAtStart string This parameter is used for finding stories whose published at time is greater than the specified value. Here you can find more information about how to work with dates. [optional]
PublishedAtEnd string This parameter is used for finding stories whose published at time is less than the specified value. Here you can find more information about how to work with dates. [optional]
CategoriesTaxonomy string This parameter is used for defining the type of the taxonomy for the rest of the categories queries. You can read more about working with categories here. [optional] [enum: iab-qag, iptc-subjectcode]
CategoriesConfident bool This parameter is used for finding stories whose categories are confident. You can read more about working with categories here. [optional] [default to true]
CategoriesId []string This parameter is used for finding stories by categories id. You can read more about working with categories here. [optional]
NotCategoriesId []string This parameter is used for excluding stories by categories id. You can read more about working with categories here. [optional]
CategoriesLevel []int32 This parameter is used for finding stories by categories level. You can read more about working with categories here. [optional]
NotCategoriesLevel []int32 This parameter is used for excluding stories by categories level. You can read more about working with categories here. [optional]
EntitiesTitleText []string This parameter is used to find stories based on the specified entities `text` in story titles. You can read more about working with entities here. [optional]
NotEntitiesTitleText []string This parameter is used to exclude stories based on the specified entities `text` in story titles. You can read more about working with entities here. [optional]
EntitiesTitleType []string This parameter is used to find stories based on the specified entities `type` in story titles. You can read more about working with entities here. [optional]
NotEntitiesTitleType []string This parameter is used to exclude stories based on the specified entities `type` in story titles. You can read more about working with entities here. [optional]
EntitiesTitleLinksDbpedia []string This parameter is used to find stories based on the specified entities dbpedia URL in story titles. You can read more about working with entities here. [optional]
NotEntitiesTitleLinksDbpedia []string This parameter is used to exclude stories based on the specified entities dbpedia URL in story titles. You can read more about working with entities here. [optional]
EntitiesBodyText []string This parameter is used to find stories based on the specified entities `text` in the body of stories. You can read more about working with entities here. [optional]
NotEntitiesBodyText []string This parameter is used to exclude stories based on the specified entities `text` in the body of stories. You can read more about working with entities here. [optional]
EntitiesBodyType []string This parameter is used to find stories based on the specified entities `type` in the body of stories. You can read more about working with entities here. [optional]
NotEntitiesBodyType []string This parameter is used to exclude stories based on the specified entities `type` in the body of stories. You can read more about working with entities here. [optional]
EntitiesBodyLinksDbpedia []string This parameter is used to find stories based on the specified entities dbpedia URL in the body of stories. You can read more about working with entities here. [optional]
NotEntitiesBodyLinksDbpedia []string This parameter is used to exclude stories based on the specified entities dbpedia URL in the body of stories. You can read more about working with entities here. [optional]
SentimentTitlePolarity string This parameter is used for finding stories whose title sentiment is the specified value. [optional] [enum: positive, neutral, negative]
NotSentimentTitlePolarity string This parameter is used for excluding stories whose title sentiment is the specified value. [optional] [enum: positive, neutral, negative]
SentimentBodyPolarity string This parameter is used for finding stories whose body sentiment is the specified value. [optional] [enum: positive, neutral, negative]
NotSentimentBodyPolarity string This parameter is used for excluding stories whose body sentiment is the specified value. [optional] [enum: positive, neutral, negative]
MediaImagesCountMin string This parameter is used for finding stories whose number of images is greater than or equal to the specified value. [optional]
MediaImagesCountMax string This parameter is used for finding stories whose number of images is less than or equal to the specified value. [optional]
MediaImagesWidthMin string This parameter is used for finding stories whose width of images are greater than or equal to the specified value. [optional]
MediaImagesWidthMax string This parameter is used for finding stories whose width of images are less than or equal to the specified value. [optional]
MediaImagesHeightMin string This parameter is used for finding stories whose height of images are greater than or equal to the specified value. [optional]
MediaImagesHeightMax string This parameter is used for finding stories whose height of images are less than or equal to the specified value. [optional]
MediaImagesContentLengthMin string This parameter is used for finding stories whose images content length are greater than or equal to the specified value. [optional]
MediaImagesContentLengthMax string This parameter is used for finding stories whose images content length are less than or equal to the specified value. [optional]
MediaImagesFormat []string This parameter is used for finding stories whose images format are the specified value. [optional] [enum: BMP, GIF, JPEG, PNG, TIFF, PSD, ICO, CUR, WEBP, SVG]
NotMediaImagesFormat []string This parameter is used for excluding stories whose images format are the specified value. [optional] [enum: BMP, GIF, JPEG, PNG, TIFF, PSD, ICO, CUR, WEBP, SVG]
MediaVideosCountMin string This parameter is used for finding stories whose number of videos is greater than or equal to the specified value. [optional]
MediaVideosCountMax string This parameter is used for finding stories whose number of videos is less than or equal to the specified value. [optional]
AuthorId []int32 This parameter is used for finding stories whose author id is the specified value. [optional]
NotAuthorId []int32 This parameter is used for excluding stories whose author id is the specified value. [optional]
AuthorName string This parameter is used for finding stories whose author full name contains the specified value. [optional]
NotAuthorName string This parameter is used for excluding stories whose author full name contains the specified value. [optional]
SourceId []int32 This parameter is used for finding stories whose source id is the specified value. [optional]
NotSourceId []int32 This parameter is used for excluding stories whose source id is the specified value. [optional]
SourceName []string This parameter is used for finding stories whose source name contains the specified value. [optional]
NotSourceName []string This parameter is used for excluding stories whose source name contains the specified value. [optional]
SourceDomain []string This parameter is used for finding stories whose source domain is the specified value. [optional]
NotSourceDomain []string This parameter is used for excluding stories whose source domain is the specified value. [optional]
SourceLocationsCountry []string This parameter is used for finding stories whose source country is the specified value. It supports ISO 3166-1 alpha-2 country codes. Here you can find more information about how to work with locations. [optional]
NotSourceLocationsCountry []string This parameter is used for excluding stories whose source country is the specified value. It supports ISO 3166-1 alpha-2 country codes. Here you can find more information about how to work with locations. [optional]
SourceLocationsState []string This parameter is used for finding stories whose source state/province is the specified value. Here you can find more information about how to work with locations. [optional]
NotSourceLocationsState []string This parameter is used for excluding stories whose source state/province is the specified value. Here you can find more information about how to work with locations. [optional]
SourceLocationsCity []string This parameter is used for finding stories whose source city is the specified value. Here you can find more information about how to work with locations. [optional]
NotSourceLocationsCity []string This parameter is used for excluding stories whose source city is the specified value. Here you can find more information about how to work with locations. [optional]
SourceScopesCountry []string This parameter is used for finding stories whose source scopes is the specified country value. It supports ISO 3166-1 alpha-2 country codes. Here you can find more information about how to work with locations. [optional]
NotSourceScopesCountry []string This parameter is used for excluding stories whose source scopes is the specified country value. It supports ISO 3166-1 alpha-2 country codes. Here you can find more information about how to work with locations. [optional]
SourceScopesState []string This parameter is used for finding stories whose source scopes is the specified state/province value. Here you can find more information about how to work with locations. [optional]
NotSourceScopesState []string This parameter is used for excluding stories whose source scopes is the specified state/province value. Here you can find more information about how to work with locations. [optional]
SourceScopesCity []string This parameter is used for finding stories whose source scopes is the specified city value. Here you can find more information about how to work with locations. [optional]
NotSourceScopesCity []string This parameter is used for excluding stories whose source scopes is the specified city value. Here you can find more information about how to work with locations. [optional]
SourceScopesLevel []string This parameter is used for finding stories whose source scopes is the specified level value. Here you can find more information about how to work with locations. [optional] [enum: international, national, local]
NotSourceScopesLevel []string This parameter is used for excluding stories whose source scopes is the specified level value. Here you can find more information about how to work with locations. [optional] [enum: international, national, local]
SourceLinksInCountMin int32 This parameter is used for finding stories from sources whose Links in count is greater than or equal to the specified value. You can read more about working with Links in count here. [optional]
SourceLinksInCountMax int32 This parameter is used for finding stories from sources whose Links in count is less than or equal to the specified value. You can read more about working with Links in count here. [optional]
SourceRankingsAlexaRankMin int32 This parameter is used for finding stories from sources whose Alexa rank is greater than or equal to the specified value. You can read more about working with Alexa ranks here. [optional]
SourceRankingsAlexaRankMax int32 This parameter is used for finding stories from sources whose Alexa rank is less than or equal to the specified value. You can read more about working with Alexa ranks here. [optional]
SourceRankingsAlexaCountry []string This parameter is used for finding stories from sources whose Alexa rank is in the specified country value. It supports ISO 3166-1 alpha-2 country codes. You can read more about working with Alexa ranks here. [optional]
SocialSharesCountFacebookMin string This parameter is used for finding stories whose Facebook social shares count is greater than or equal to the specified value. [optional]
SocialSharesCountFacebookMax string This parameter is used for finding stories whose Facebook social shares count is less than or equal to the specified value. [optional]
SocialSharesCountGooglePlusMin string This parameter is used for finding stories whose Google+ social shares count is greater than or equal to the specified value. [optional]
SocialSharesCountGooglePlusMax string This parameter is used for finding stories whose Google+ social shares count is less than or equal to the specified value. [optional]
SocialSharesCountLinkedinMin string This parameter is used for finding stories whose LinkedIn social shares count is greater than or equal to the specified value. [optional]
SocialSharesCountLinkedinMax string This parameter is used for finding stories whose LinkedIn social shares count is less than or equal to the specified value. [optional]
SocialSharesCountRedditMin string This parameter is used for finding stories whose Reddit social shares count is greater than or equal to the specified value. [optional]
SocialSharesCountRedditMax string This parameter is used for finding stories whose Reddit social shares count is less than or equal to the specified value. [optional]

Return type

Trends

Example

package main

// Import the library
import (
	"fmt"
	newsapi "github.com/AYLIEN/aylien_newsapi_go"
)

func main() {
	api := newsapi.NewDefaultApi()

	// Configure API key authorization: app_id
	api.Configuration.APIKeyPrefix["X-AYLIEN-NewsAPI-Application-ID"] = "YOUR_APP_ID"

	// Configure API key authorization: app_key
	api.Configuration.APIKeyPrefix["X-AYLIEN-NewsAPI-Application-Key"] = "YOUR_APP_KEY"

	field := "keywords"
	id := []int64{2541}
	notId := []int64{5411, 6565}
	title := "startup AND (raise OR raised OR raising OR raises)"
	body := "startup"
	text := "startup company"
	language := []string{"en", "de"}
	notLanguage := []string{"it", "es"}
	publishedAtStart := "NOW-2MONTHS"
	publishedAtEnd := "NOW"
	categoriesTaxonomy := "iptc-subjectcode"
	categoriesConfident := "true"
	categoriesId := []string{"11000000"}
	notCategoriesId := []string{"10000000", "04001000"}
	categoriesLevel := []int32{3}
	notCategoriesLevel := []int32{1, 2}
	entitiesTitleText := []string{"GNU/Linux"}
	notEntitiesTitleText := []string{"Windows", "Microsoft"}
	entitiesTitleType := []string{"Software", "Organization"}
	notEntitiesTitleType := []string{"Person", "Agent"}
	entitiesTitleLinksDbpedia := []string{"http://dbpedia.org/resource/Linux"}
	notEntitiesTitleLinksDbpedia := []string{"http://dbpedia.org/resource/Windows"}
	entitiesBodyText := []string{"Free Software"}
	notEntitiesBodyText := []string{"Open Source Software"}
	entitiesBodyType := []string{"Software", "Organization"}
	notEntitiesBodyType := []string{"Agent", "Person"}
	entitiesBodyLinksDbpedia := []string{"http://dbpedia.org/resource/Linux"}
	notEntitiesBodyLinksDbpedia := []string{"http://dbpedia.org/resource/Microsoft"}
	sentimentTitlePolarity := "positive"
	notSentimentTitlePolarity := "neutral"
	sentimentBodyPolarity := "neutral"
	notSentimentBodyPolarity := "neutral"
	mediaImagesCountMin := "3"
	mediaImagesCountMax := "4"
	mediaImagesWidthMin := "640"
	mediaImagesWidthMax := "1024"
	mediaImagesHeightMin := "480"
	mediaImagesHeightMax := "800"
	mediaImagesContentLengthMin := "25412"
	mediaImagesContentLengthMax := "369521"
	mediaImagesFormat := []string{"JPEG", "BMP", "GIF"}
	notMediaImagesFormat := []string{"PNG", "TIFF"}
	mediaVideosCountMin := "1"
	mediaVideosCountMax := "2"
	authorId := []int32{144}
	notAuthorId := []int32{142, 455}
	authorName := "John Doe"
	notAuthorName := "Mike Wally"
	sourceId := []int32{163}
	notSourceId := []int32{354, 141}
	sourceName := []string{"BBC"}
	notSourceName := []string{"Fox News"}
	sourceDomain := []string{"bbc.co.uk"}
	notSourceDomain := []string{"foxnews.com"}
	sourceLocationsCountry := []string{"US"}
	notSourceLocationsCountry := []string{"IE", "IR"}
	sourceLocationsState := []string{"California"}
	notSourceLocationsState := []string{"Arizona"}
	sourceLocationsCity := []string{"Los Angeles"}
	notSourceLocationsCity := []string{"New York City"}
	sourceScopesCountry := []string{"IE"}
	notSourceScopesCountry := []string{"IE"}
	sourceScopesState := []string{"Co Dublin"}
	notSourceScopesState := []string{"Wicklow"}
	sourceScopesCity := []string{"Dublin City"}
	notSourceScopesCity := []string{"Cork"}
	sourceScopesLevel := []string{"local"}
	notSourceScopesLevel := []string{"national"}
	sourceLinksInCountMin := int32(142221)
	sourceLinksInCountMax := int32(325000)
	sourceRankingsAlexaRankMin := int32(1)
	sourceRankingsAlexaRankMax := int32(10)
	sourceRankingsAlexaCountry := []string{"IE"}
	socialSharesCountFacebookMin := "3521"
	socialSharesCountFacebookMax := "5841"
	socialSharesCountGooglePlusMin := "2514"
	socialSharesCountGooglePlusMax := "36521"
	socialSharesCountLinkedinMin := "6521"
	socialSharesCountLinkedinMax := "36521"
	socialSharesCountRedditMin := "14125"
	socialSharesCountRedditMax := "95412"

	trendsParams := &newsapi.TrendsParams{
		Field:                          field,
		Id:                             id,
		NotId:                          notId,
		Title:                          title,
		Body:                           body,
		Text:                           text,
		Language:                       language,
		NotLanguage:                    notLanguage,
		PublishedAtStart:               publishedAtStart,
		PublishedAtEnd:                 publishedAtEnd,
		CategoriesTaxonomy:             categoriesTaxonomy,
		CategoriesConfident:            categoriesConfident,
		CategoriesId:                   categoriesId,
		NotCategoriesId:                notCategoriesId,
		CategoriesLevel:                categoriesLevel,
		NotCategoriesLevel:             notCategoriesLevel,
		EntitiesTitleText:              entitiesTitleText,
		NotEntitiesTitleText:           notEntitiesTitleText,
		EntitiesTitleType:              entitiesTitleType,
		NotEntitiesTitleType:           notEntitiesTitleType,
		EntitiesTitleLinksDbpedia:      entitiesTitleLinksDbpedia,
		NotEntitiesTitleLinksDbpedia:   notEntitiesTitleLinksDbpedia,
		EntitiesBodyText:               entitiesBodyText,
		NotEntitiesBodyText:            notEntitiesBodyText,
		EntitiesBodyType:               entitiesBodyType,
		NotEntitiesBodyType:            notEntitiesBodyType,
		EntitiesBodyLinksDbpedia:       entitiesBodyLinksDbpedia,
		NotEntitiesBodyLinksDbpedia:    notEntitiesBodyLinksDbpedia,
		SentimentTitlePolarity:         sentimentTitlePolarity,
		NotSentimentTitlePolarity:      notSentimentTitlePolarity,
		SentimentBodyPolarity:          sentimentBodyPolarity,
		NotSentimentBodyPolarity:       notSentimentBodyPolarity,
		MediaImagesCountMin:            mediaImagesCountMin,
		MediaImagesCountMax:            mediaImagesCountMax,
		MediaImagesWidthMin:            mediaImagesWidthMin,
		MediaImagesWidthMax:            mediaImagesWidthMax,
		MediaImagesHeightMin:           mediaImagesHeightMin,
		MediaImagesHeightMax:           mediaImagesHeightMax,
		MediaImagesContentLengthMin:    mediaImagesContentLengthMin,
		MediaImagesContentLengthMax:    mediaImagesContentLengthMax,
		MediaImagesFormat:              mediaImagesFormat,
		NotMediaImagesFormat:           notMediaImagesFormat,
		MediaVideosCountMin:            mediaVideosCountMin,
		MediaVideosCountMax:            mediaVideosCountMax,
		AuthorId:                       authorId,
		NotAuthorId:                    notAuthorId,
		AuthorName:                     authorName,
		NotAuthorName:                  notAuthorName,
		SourceId:                       sourceId,
		NotSourceId:                    notSourceId,
		SourceName:                     sourceName,
		NotSourceName:                  notSourceName,
		SourceDomain:                   sourceDomain,
		NotSourceDomain:                notSourceDomain,
		SourceLocationsCountry:         sourceLocationsCountry,
		NotSourceLocationsCountry:      notSourceLocationsCountry,
		SourceLocationsState:           sourceLocationsState,
		NotSourceLocationsState:        notSourceLocationsState,
		SourceLocationsCity:            sourceLocationsCity,
		NotSourceLocationsCity:         notSourceLocationsCity,
		SourceScopesCountry:            sourceScopesCountry,
		NotSourceScopesCountry:         notSourceScopesCountry,
		SourceScopesState:              sourceScopesState,
		NotSourceScopesState:           notSourceScopesState,
		SourceScopesCity:               sourceScopesCity,
		NotSourceScopesCity:            notSourceScopesCity,
		SourceScopesLevel:              sourceScopesLevel,
		NotSourceScopesLevel:           notSourceScopesLevel,
		SourceLinksInCountMin:          sourceLinksInCountMin,
		SourceLinksInCountMax:          sourceLinksInCountMax,
		SourceRankingsAlexaRankMin:     sourceRankingsAlexaRankMin,
		SourceRankingsAlexaRankMax:     sourceRankingsAlexaRankMax,
		SourceRankingsAlexaCountry:     sourceRankingsAlexaCountry,
		SocialSharesCountFacebookMin:   socialSharesCountFacebookMin,
		SocialSharesCountFacebookMax:   socialSharesCountFacebookMax,
		SocialSharesCountGooglePlusMin: socialSharesCountGooglePlusMin,
		SocialSharesCountGooglePlusMax: socialSharesCountGooglePlusMax,
		SocialSharesCountLinkedinMin:   socialSharesCountLinkedinMin,
		SocialSharesCountLinkedinMax:   socialSharesCountLinkedinMax,
		SocialSharesCountRedditMin:     socialSharesCountRedditMin,
		SocialSharesCountRedditMax:     socialSharesCountRedditMax}

	trendsResponse, res, err := api.ListTrends(trendsParams)
	if err != nil {
		panic(err)
	}
	_ = res

	fmt.Println(trendsResponse)
}