Warning

This site is no longer being maintained. Visit the eDocs documentation portal for updated information.

Visit eDocs
Dismiss message

Empathize API

Created by Iago Fernández · last update December 10, 2019

About this endpoint

The empathize endpoint will return the TopTrends for the query

GET https://api.empathybroker.com/search/v1/query/{instance_id}/empathize?{Input_Parameters}

Input Parameters

Parameter Data Type
q String
lang String
start Integer
rows Integer

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"
        }
    ]
}