Links

Trend Search

Performing a realtime google trends search using HTTP POST is very simple to the Google trend live endpoint.
Requires authentication

Example request:

BASH
RUBY
PYTHON
NODE.JS
PHP
JAVA
JAVASCRIPT
GO
C#/.NET
curl --location --request POST 'https://api.serphouse.com/trends/search' \
--header 'Authorization: Bearer <YOUR_API_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"time_zone_offset": "-330",
"keywords": "google,youtube",
"time": "now 1-d",
"property": "youtube",
"category": "0",
"geo": "us",
"langauge_code": "en"
}'
require "uri"
require "json"
require "net/http"
url = URI("https://api.serphouse.com/trends/search")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer <YOUR_API_TOKEN>"
request.body = JSON.dump({
"time_zone_offset": "-330",
"keywords": "google,youtube",
"time": "now 1-d",
"property": "youtube",
"category": "0",
"geo": "us",
"langauge_code": "en"
})
response = https.request(request)
puts response.read_body
import requests
import json
url = "https://api.serphouse.com/trends/search"
payload = json.dumps({
"time_zone_offset": "-330",
"keywords": "google,youtube",
"time": "now 1-d",
"property": "youtube",
"category": "0",
"geo": "us",
"langauge_code": "en"
})
headers = {
'Authorization': 'Bearer <YOUR_API_TOKEN>',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
var data = JSON.stringify({
"time_zone_offset": "-330",
"keywords": "google,youtube",
"time": "now 1-d",
"property": "youtube",
"category": "0",
"geo": "us",
"langauge_code": "en"
});
var config = {
method: 'post',
url: 'https://api.serphouse.com/trends/search',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer <YOUR_API_TOKEN>'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
<?php
$client = new GuzzleHttp\Client();
$headers = [
'Authorization' => 'Bearer <YOUR_API_TOKEN>',
'Content-Type' => 'application/json'
];
$body = '{
"time_zone_offset": "-330",
"keywords": "google,youtube",
"time": "now 1-d",
"property": "youtube",
"category": "0",
"geo": "us",
"langauge_code": "en"
}';
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.serphouse.com/trends/search', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
JSONObject jsonObject = new JSONObject();
jsonObject.put("time_zone_offset", "-330");
jsonObject.put("keywords", "google,youtube");
jsonObject.put("time", "now 1-d");
jsonObject.put("property", "youtube");
jsonObject.put("category", "0");
jsonObject.put("geo", "us");
jsonObject.put("language_code", "en");
String bodyJson = jsonObject.toString();
RequestBody body = RequestBody.create(mediaType, bodyJson);
Request request = new Request.Builder()
.url("https://api.serphouse.com/trends/search")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer <YOUR_API_TOKEN>")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer <YOUR_API_TOKEN>");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"time_zone_offset": "-330",
"keywords": "google,youtube",
"time": "now 1-d",
"property": "youtube",
"category": "0",
"geo": "us",
"langauge_code": "en"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.serphouse.com/trends/search", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.serphouse.com/trends/search"
method := "POST"
payload := strings.NewReader(`{
"time_zone_offset": "-330",
"keywords": "google,youtube",
"time": "now 1-d",
"property": "youtube",
"category": "0",
"geo": "us",
"langauge_code": "en"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer <YOUR_API_TOKEN>")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var client = new RestClient("https://api.serphouse.com/trends/search");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer <YOUR_API_TOKEN>");
var body = @" {
""time_zone_offset"": ""-330"",
""keywords"": ""google,youtube"",
""time"": ""now 1-d"",
""property"": ""youtube"",
""category"": ""0"",
""geo"": ""us"",
""language_code"": ""en""
}";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);