Google Trends

FREEMIUM
Par News.Agent-API | Mise à jour il y a un an | News, Media
Popularité

8.9 / 10

Latence

1,384ms

Niveau de service

100%

Retour à tous les tutoriels (4)

How to use - /api/v1/DailyTrendingSearches Endpoint

The aim of this tutorial is to explain below items:

  1. API endpoint name: /api/v1/DailyTrendingSearches
  2. API endpoint accepting parameters: /{requestId}/{countryCode}/{resultCount}/{date}
  3. How to use this API method.

This is the very first API endpoint you will need to call in order to access real time Google trends. It is accepting four (4) parameters , please see below for further details:

  1. {requestId} - This is a reference Id for you , so you can keep track when the API respond back to your call and in the respond it has the same request Id which you have sent in the request.
  2. {countryCode} - This is the desired country which you are requesting trending news for. In order to get the full country code list, please use /api/v1/CountryCodeDetails API endpoint. Ex: for the country Australia the country code is: AU
  3. {resultCount} - This will tell the API how much results you are expecting in the response object. The maximum number of result is cap to 20 records.
  4. {date} - This is the desired date which you are requesting news for. The date can be set to MAX 30 days past from the current date.

Once you are familiar with above parameters, now it is time to know how to consume this API. Please see below simple steps:

Prepare your request:

  1. We hope you are using this API for a product or a project, so you can stick to your favorite programming language.
  2. Once you pick the programming language , all you have to do is, Use it’s HTTP client module to connect to this API.
  3. Rapid API also has put some examples so you could never go wrong.
  4. In your HTTP client module , please set the HTTP URL as : https://google-trends.p.rapidapi.com/api/v1/DailyTrendingSearches
  5. In your HTTP client module , please set the HTTP method as: GET
  6. Also you need to pass all the above parameters in this way: https://google-trends.p.rapidapi.com/api/v1/DailyTrendingSearches/Ref12345/US/15/20200923
  7. Also if you have subscribed to our API you should already have an API KEY, you need to add that as a herder key:value as below, into the HTTP request header section:
  8. x-rapidapi-key : {YOUR RAPID API KEY}

Using response :

  1. Once you have done above steps, Please see below which explain how to consume the response.
  2. In the response you would see below data
    {
    “errorMessage”: “NULL”,
    “friendlyFormattedDate”: “Wednesday, 23 September 2020”,
    “googleTrendingSearchList”: [
    {
    “trendingSearchTitle”: {
    “rankId”: 1,
    “searchTitle”: “Luton Town vs Man United”
    },
    “trendingSearchToken”: “749d54e2-5f1f-4305-a10b-1a4be78b94c5:AU-20200923”
    },
    {
    “trendingSearchTitle”: {
    “rankId”: 2,
    “searchTitle”: “William Wall”
    },
    “trendingSearchToken”: “2c4a635d-2882-4d59-ab09-73a32dd4f938:AU-20200923”
    }
    ],
    “tokenExpirationTime”: “Wednesday, 23 September 2020 21:44:38”,
    “tokenExpirationTimeInUtc”: “Wednesday, 23 September 2020 11:44:38”,
    “userRequestId”: “Request Id from the request”
    }
  3. As you can see above response has two “trending Search Titles” for the given date (20200923) and for the given country (US)
  4. Also each trending title object has a “trending Search Token” key which can be used for future API requests to get more details on your preferred response news title.
Note : 5 - Votes : 1