BING search in Knime

Hello,

I am trying to import some bing searches into KNIME unsuccessfully. I am not a developer and probably there is something wrong on my coding. The curl of the app is:

curl -H “Ocp-Apim-Subscription-Key: ” https://api.bing.microsoft.com/v7.0/search?q=microsoft+devices

Therefore I am using the GET REQUEST node by entering in the URL: under the Connecting Settings tab: https://api.bing.microsoft.com/v7.0/search?q=microsoft+devices under the URL
… and creating in the REquest Headers Tab of the node a:

Header key with: Ocp-Apim-Subscription-Key
and value: xxxxx (my key 1 from the api)

what I am doing wrong?

Hi @Charlie20,
What you are doing looks correct. What is the error you are getting back? Interesting would be to know the status code and when the body column has a missing value (red question mark), you can hover your mouse over the question mark and it may show a tooltip with some error details.
Kind regards,
Alexander

1 Like

Hi Alexander,

Many thanx for your help. I get the 401 but can’t read any message.
Knime error message

However, I tried running the curl on the windows command prompt and got what follows:

C:\Users\xxxxxxxx>curl -H “Ocp-Apim-Subscription-Key:xxxxx” https://api.bing.microsoft.com/v7.0/search?q=microsoft+devices
{“error”:{“code”:“401”,“message”: “The Search Operation under Web Search API - v7 is not supported with the current subscription key and pricing tier Bing.CustomSearch.F0.”}}

… so can it be that this is a MS/ Bing problem?

Br,

Carles

Hi,
Yes, this seems to be a problem with Bing. The HTTP status code 401 stands for “Unauthorized”. This can either mean that the subscription key is not sent properly, or that it is not valid. Judging by the message you posted, it seems to be the latter.
Kind regards,
Alexander

1 Like

Hi guys,

I tried with the simple link and the rest get node and works fine.

image

I just create a table with the URL as below and then I made a request using Get Request node from URL variable.

image

The status was OK - 200 code as the print below

I know that the API give a clean code for use, but if you can’t use it, you can make it from this method.

I hope help you,

Denis

2 Likes

Hi Denis,
Thanks for this solution. What should be kept in mind when going this route is that you might run into rate limiting if you make too many requests in rapid succession.
Another tipp: you can use this component from KNIME Hub to turn the HTML into XML so the XPath node can be used to extract information more cleanly.
Kind regards,
Alexander

2 Likes

Sure Alexander! I just show another way to get some results to help him… Tks for your complete answer about it.

Best regards,

Denis

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.