Empathize API
Created by Iago Fernández · last update December 10, 2019
Implementation
Here is an example of a simple implementation in Java to consume this service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Client client;
WebTarget target;
public void init(){
client = ClientBuilder.newClient();
target = client.target("https://api.empathybroker.com/search/v1/query/{instance_id}/empathize")
//Query parameters
.queryParam("lang","ES")
.queryParam("start",0)
.queryParam("rows",5)
}
public JSON getResponse(String query){
return target.queryParam("q",query).request(MediaType.APPLICATION_JSON).get(JSON.class)
}
Output
The empathize endpoint will return a single Json node with the TopTrends
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
topTrends: [
{
title: "<b>spho</b>ne",
title_raw: "sphone",
facets: [
{
facet: "rootCategories_facet"
values: [
{
value: "Mobile Phones",
count: 5,
filter: "{!tag=rootFilter}rootCategories_facet:Mobile Phones"
},
{
value: "Phone Accessories",
count: 3,
filter: "{!tag=rootFilter}rootCategories_facet:Phone Accessories"
}
]
}
]
},
{
title: "<b>spho</b>ne galaxy",
title_raw: "sphone galaxy"
},
{
title: "tablet <b>spho</b>ne",
title_raw: "tablet sphone"
}
]
}