Struggling with Google API searches structure in GET request node

Hello everyone,

I’m creating a KNIME workflow to automatize a search with Google Custom Search JSON API of a query [es: (“Lager beer” OR “IPA”) AND “brewery”] in a list of specific websites (es:
https://www.paulaner.com/).

I’m struggling with GET REQUEST node because I don’t understand how to structure the pattern to be search (URL) that works with Get request node.
With STRING MANIPULATION I created the following query:

https://www.googleapis.com/customsearch/v1?q=(Lager+beer+OR+IPA)+AND+brewery&cx=XXX&key=XXX&siteSearch=paulaner.com/

but it does not work.

Would appreciate any help. Thank you in advance!

Hey @Caterina_Rovegn,

Welcome to the community!

So I played around with google custom search API, and was able to get json through the url like yours provided. However, in KAP, which I assume you were running into is you get a bunch of missing values like so after you just copy paste the url:

image

After I ran into that, I enabled the error output on the node to see if there was any errors, and got a invalid url which is most likely due to characters that are invalid.

To fix these, make sure:

  • Parentheses are %28
  • Plus signs with %2B
  • Spaces with %20

So the new url used should be:

https://www.googleapis.com/customsearch/v1?q=(Lager%20beer%20OR%20IPA)%20AND%20brewery&cx=YOUR_CX&key=YOUR_API_KEY&siteSearch=paulaner.com

The results:

You could also use the webpage retriever node too if you want:

Hope this helps,
TL

1 Like

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