简体   繁体   中英

How to query IBM Watson Discovery News with REST api?

Is there an opportunity in IBM Watson Discovery News to query news just with the url where I can specify keywords, api etc. Would appreciate if anybody could share the template of such REST request. I created the account, launched the Discovery but then completely lost in the IBM Cloud API Docs https://cloud.ibm.com/apidocs/discovery . As far as I can see, here everything is for accessing via command line but it is not what I'm looking for...

This is what I used for Alchemy:

https://access.alchemyapi.com/calls/data/GetNews?apikey= &return=enriched.url.title&start=1477008000&end=now&q.enriched.url.cleanedTitle=InsertTitle&count=100&outputMode=xml

Best, Lada

Occasionally all you need to do is read the documentation - https://cloud.ibm.com/apidocs/discovery#query-a-collection-get


curl -u "apikey":"{apikey}" "https://gateway.watsonplatform.net/discovery/api/v1/environments/system/collections/news-en/query?version=2019-04-30&natural_language_query=corvid&count=10&return=text"

which becomes

https://apikey:{apikey}@gateway.watsonplatform.net/discovery/api/v1/environments/system/collections/news-en/query?version=2019-04-30&natural_language_query=corvid&count=100&return=text

although if you just run

https://gateway.watsonplatform.net/discovery/api/v1/environments/system/collections/news-en/query?version=2019-04-30&natural_language_query=corvid&count=10&return=text

you will be prompted for credentials.

You may need to amend the url endpoint to reflect the region you have your discovery service instance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM