Applying the API instructions in KNIME


I would like to use the Facebook Library Ad API. As I’m reading the API documentation, I think I’m gonna need some help to do it if I am to use KNIME.

The documentation link I’m referring to is here:

The curl command as shown in the link is:

curl -G \
  -d 'end_time=1517287567' \
  -d 'fields=impressions,inline_link_clicks,spend' \
  -d 'access_token=<ACCESS_TOKEN>' \<CAMPAIGN_ID>/insights

There is also the Java Business SDK command provided in the documentation as alternative:

APINodeList<AdsInsights> adsInsightss = new Campaign(<CAMPAIGN_ID>, context).getInsights()
 .setParam("end_time", end_time)

Background info:

  • I’m not a coder.
  • I have obtained my access tokens.
  • I’m only familiar with the HTTP Retriever node that I used in past projects, but that node is simple and I didn’t need any authorization for those other projects.

Based on these instructions, how do I apply them in KNIME? Perhaps the GetRequest Node or the Java Snippet Node can be of use?

Thanks in advance!

Hi badger101,

that request is in fact rather simple. The CURL translates to a request URL as follows using GET:<CAMPAIGN_ID>/insights?end_time=1517287567&fields=impressions,inline_link_clicks,spend&access_token=<ACCESS_TOKEN>'

-G means “GET”, -d are (in case of GET) the query params.

This you can simply pass as one string column into the HTTP Retriever.

If you want to acquire the access token through your workflow (instead of passing it statically), you can also have a look at this one:



Thank you @qqilihq , I’ll try it out later today, but this looks promising at first glance. Will update here!

1 Like

I have marked this as solved, since the query parameters explained above are what I was looking for.

@qqilihq Thank you again. As a side question, do you know if there’s a way I can read .har files with Knime? (if this requires a lengthy answer, I can make a separate forum post)

Should be possible with python package


1 Like

… beside that:

Generally a HAR is “just” a JSON, so you can also parse it manually through the JSON-related nodes.


Yes I figured that out yesterday after doing some Googling. Was able to do it via Json Reader :grin: (Turns out the File Reader Complex can do it too).

@qqilihq Hi Philipp, regarding the OAuth Connector Beta Node, I tried using it for my Twitter API. I know this thread is for Facebook, but since you recommended the node here, I’d like to point out that I found the node to not work with Twitter, as you’ve been made known in this forum thread → here which was closed.

Here’s what happened:

  • I keyed in my API & Secret Keys, and proceeded with the Authorize button. But nothing occurred. (No browser window pops out)

  • Since I thought this might have something to do with my default Knime configuration just to check it out, I went to the File Menu > Preferences > General > Web Browser, and my default setting was like this:

  • I retried the Twitter API access, but the issue wasn’t resolved - no browser window pops out.

  • I changed my preferences to this:

And still got no results. Just to play around, I randomly choose some of the other services apart from Twitter, but this time with dummy access tokens, and I managed to get the Chrome browser to pop out. I’d appreciate it if you can take a second look at the Twitter issue :grin: I just got my v2 access token this week, so in the meantime I’ll have a go at the Twitter API Connector Node.

Hi Badger,

thanks for the feedback!

  • I keyed in my API & Secret Keys, and proceeded with the Authorize button. But nothing occurred. (No browser window pops out)
  1. Currently some errors are logged to the console*, but might be filtered out if your log level is too high. You can enable DEBUG logging and probably see some helpful output in the console.

  2. If you’d see the DEBUG log, I’d highly suspect that you’ll see something like this along the lines:

    response body: <?xml version='1.0' encoding='UTF-8'?><errors><error code="417">Desktop applications only support the oauth_callback value 'oob'</error></errors>
  3. If that’s the case, you’ll need to set up “User authentication set up” in your Twitter project:


    The crucial part is to supply the “Callback URI / Redirect URL” which must be exactly as follows (see node documentation):


I’m still collecting plenty of feedback for this node, so please do let me know if that helps!


*) We’ll improve this in the next release to show a proper error dialog as console output usually just gets lost

@qqilihq , This is the error I’m seeing after clearing the log file and replicating the process:

2022-09-18 23:37:27,476 : WARN : main : : Node : OAuth Connector [BETA] : 3:1 : Please configure the node and authorize access through the corresponding button.
2022-09-18 23:37:33,271 : WARN : main : : Node : OAuth Connector [BETA] : 3:1 : Please configure the node and authorize access through the corresponding button.


Okay, I have enabled the User authentication setup as instructed, and I managed to get access via the node now. :grin: I’m wondering why does Twitter give me these two additional tokens: Client ID & Client Secret ID right after I set up the authentication, when the only tokens I need are the API key and the API secret key (for the OAuth Beta Node) (and Access token & Access Token Secret for the Twitter API Connector).

Anyway, here’s the screen showed to me once authenticated:

And I want to ask about this ‘refresh token’ section which appears ‘missing’ in the output port of the OAuth.

I’m not sure under what circumstances will I need a ‘refresh token’, and if I do, how do I set it up in the OAuth node? The doc gives me this info:

My project doesn’t require me to make POST requests, rather only GET requests. I’m hoping/assuming this “offline.access” scope, whatever that means, will not be troubling me in any way. :rofl:

I haven’t had the chance until today to make my query.

So far, I always get 404 errors. Then I have a look around the Twitter docs, it seems that I will have to convert this curl command :

I have the ID and the bearer token, but I don’t know how to convert this to the complete URL. The difference between this curl and that of the Facebook’s:

  • It contains spaces

  • It uses -H instead of -d

Kindly help me out @qqilihq when you get back.

-H means header, i.e. you send the following information in the header.

  1. Add a column called Authorization to your table
  2. Put the value Bearer XXXXXXXXXXXXXXXX as value
  3. Select it in the HTTP Retriever’s “Headers” tab.

That should do :slight_smile:

1 Like

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