Forum Discussion

Julian_Kartte's avatar
4 months ago
Solved

Trend Endpoint: search for entity types

Have you already searched the Community for similar issues? The answer may already be waiting for you.

To help you get an answer as quickly as possible, fill out the following template (please do not delete, or miss out any fields - this will delay the resolution time): 

Description: Using trends-endpoint to search for entities of type "Company"

Support type: expected behavior

Version:

Components: Quantexa News Intelligence, News API

Debugging:  e.g. copies of logs, Developer Tools errors, links to Documentation and Community posts consulted

Code (please insert into the code block below):

params = {    'published_at': '[NOW-14DAYS TO NOW]',    'language': '(de)',    'categories': '{{taxonomy:aylien AND id:(ay.lifesoc.esg) AND score:>=0.65}}',    'entities': '{{types:("Company")}}', # this does not work    'field': 'entities.surface_forms.text',}
response = requests.get('https://api.aylien.com/v6/news/trends', params=params, headers=headers)
print(response)
print(response.content)
# b'{"errors":[{"id":"trends_params_entities","links":{"about":"https://docs.aylien.com/newsapi/#error-codes-amp-responses","docs":"https://docs.aylien.com/newsapi"},"type":"http://httpstatus.es/422","title":"Unsupported parameter in AQL query.","status":422,"code":"KB422","detail":"Unsupported field: entities.types"}]}'

Is something like 'entities': '{{types:("Company")}}' possible?

  • Hey

    Welcome to the Quantexa Community! :)

    it's possible, but please change your syntax to the following:

    params = {    
    'published_at': '[NOW-14DAYS TO NOW]',
    'language': '(de)',
    'categories': '{{taxonomy:aylien AND id:(ay.lifesoc.esg) AND score:>=0.65}}',
    'entities': '{{type:("Company")}}'
    }

2 Replies

  • Hey

    Welcome to the Quantexa Community! :)

    it's possible, but please change your syntax to the following:

    params = {    
    'published_at': '[NOW-14DAYS TO NOW]',
    'language': '(de)',
    'categories': '{{taxonomy:aylien AND id:(ay.lifesoc.esg) AND score:>=0.65}}',
    'entities': '{{type:("Company")}}'
    }

  • Also, your question was posted in Quantexa Platform Support, but it actually belongs in Quantexa News Intelligence.

    I’ll go ahead and move it to the right category! :)