Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

connection qlik sense to twitter

Hi community

I want to connect to my twitter account with qlik sense; I followed the steps to fill in all the identifiers; I created a connection with REST connector; I filled in all the fields but when I test the connection; it does not work . I have an error

rest.PNGfailed .PNG

11 Replies
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

HI Mariam,

I think you may need to remove the quotes from your Authorisation header, take out both instances of "

Hope that works for you,

Steve

Anonymous
Not applicable
Author

Hi

Thank you for your feedback sir ; but i don't get your point ;more details plz

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

When I have an Authorization key it has the quotes shown as quotes, rather than URL encoded, as "


I use PostMan ( https://www.getpostman.com/ ) to generate the Authorization string and then paste it in.

pm.jpg

sense.jpg

Note that the start of the oauth_consumer_key is a " symbol.

Watch that the Authorization key changes with the slightest change to the end point.  Even changing a search parameter or number of rows returned will change this.

Steve

Anonymous
Not applicable
Author

It works thank you

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

HI Mariam,

You may also like to look at this blog post by catalystmichael‌ which talks about the Spotify API.  It's a different API, but the techniques are very similar:

https://adventuresinqlik.com/2017/11/12/spotify-rest-qlik/

Steve

Anonymous
Not applicable
Author

What else did you provide in Header : Authorization other than consumer key. Where can I refer to the document related to this?

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

I'm hoping to polish my app, document it and upload it sometime soon.  In the meantime here are some snippets from my load script that may help...

// To use this application you first need a valid Twitter acccount

// Log in to this and then go to https://apps.twitter.com and create a new API app

// Enter all the required information for a read only API application

// Go to the Keys and Application Keys tab and copy the Consumer Key and Secret into a new string separated by :

// Ensure that there are no rogue spaces or characters in this key

// Go to the site https://www.base64encode.org and paste your string in the top box

// Press the Encode button and a new string will be generated and appear in the bottom box

// Copy and pasted this string into the vBASE64 variable below

let vBASE64Key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

tmpBearerKey:

    SQL SELECT

"tokem_type",

        "access_token"

    FROM JSON (wrap on) "root" PK "__KEY_root"

WITH CONNECTION ( 

      URL "https://api.twitter.com/oauth2/token",

      HTTPHEADER "content-type" "application/x-www-form-urlencoded",

      HTTPHEADER "Authorization" "Basic $(vBASE64Key)",

      QUERY "grant_type" "client_credentials"

    )

;

let vBearerKey = peek('access_token', -1, 'tmpBearerKey');

DROP TABLE tmpBearerKey;

SELECT

...

FROM JSON (wrap off) "statuses" PK "__KEY_statuses"

WITH CONNECTION ( 

      URL "https://api.twitter.com/1.1/search/tweets.json?q=%23$(vHashTag)&result_type=recent&count=200$(vMaxTw...)",   

      HTTPHEADER "Authorization" "Bearer $(vBearerKey)"

    );

Steve

rkondaveti
Contributor III
Contributor III

Hi Steve,

Did you get a chance to polish your app ? i am trying to extract data from Twitter but i struck at generating Oauth Signature and Oauth nonce. How did you generate them in your app ?

Cheers,

Raghav.

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

The Base64 key was created using an online Base 64 converter - is that what you are stuck at?

Another way of looking at Twitter in Sense is to sign up for a Cloud account at http://www.qlikcloud.com/ and then look in the Qlik Cloud Resources stream.  There is a Twitter app you can copy and amend.

Hope that helps,

Steve