Qlik Community

Ask a Question

Connectivity & Data Prep

Discussion board where members can learn more about Qlik Sense Data Connectivity.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
vidhyaranganath
Partner
Partner

Linkedin Connection

Hi ,

I am trying to connect Linkedin Data with Qliksense/Qlikview. I am looking for any information that can help me do so . Any help much appreciated..

Thanks,

Vidhya.

8 Replies
ansahmad179
Contributor II
Contributor II

Hi There!

Did you found any solution? If not, then use POSTMAN and get access token of your LinkedIn. From that you can get data in JSON format. But there are some problems for loading nested JSON which LinkedIn currently have. What I did is I wrote custom Node JS script and extracted the data to CSV and loaded it Qlik Sense. I am still looking for efficient solution for this if you have any let me know. 

 

Regards,

Ans Ahmad

jabares123
Partner
Partner

Hello, I am at the same point. The solution you mention sounds very interesting, with an external web service that resolves the connection and access to the data and then export it to csv for Qlik Sense to load. Could you give me more details or an example of that external web service?

stevedark
MVP
MVP

There should be no need to go via CSV. If you can get it to work in Postman then you can take those settings and plumb them into a REST connection. 

I believe I have done this as a PoC at some point. I will see if I can dig up the code. 

You may find someone else has already posted a solution to Community. If so, please post a link below. 

Steve

jabares123
Partner
Partner

Thanks for the reply. I don't know if I have understood correctly, is it possible to make the whole connection from qlik sense? in several steps but wouldn't an external web service be necessary? I am looking for a lot of information about the connection with linkedin but nothing is clear from qlik sense.

jabares123
Partner
Partner

I get lost along the way, because the api connections with token, resfresh token and authorizations with the user, etc ... I don't know how to implement all this process in qlik sense, at least I can't think of the way, since I always think of something very automatic but with linkedin I think it cannot be possible for it to be automatic due to the token. I don't know if I'm right or I'm going the wrong way.

stevedark
MVP
MVP

Hi @jabares123 

The only code I can find where I loaded from LinkedIn is using Qlik Web Connectors (which I wrote 9 years ago!).  It looks like LinkedIn is no longer one of the connectors for QWC ( @chrisbrain may be able to shed light on why).

I believe I have done it just using the REST connector though, just I've not kept the code anywhere obvious.

It is likely to require a multi-part authentication. Here is some code for Twitter authentication, it may be similar in LinkedIn. Make sure you prove everything in PostMan and check the API documentation as you go.

// 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
// If they have not been created when the app is loaded you will need to create two REST connections
// GenericGET and GenericPOST both need to point to http://jsonplaceholder.typicode.com/posts and should be set ot GET and POST respectively
// All other settings can be left as defaults as these will get overwritten anyway
// Set the vTwitterName variable to the name you wish to retrive the stream for
// Set the vDataFolder variable to the location for your incremental QVDs
// Once this has been done you can reload, a new bearer token will be created and your Tweets will load

// This key is an encoded version of your API Key and Secret
let vBASE64Key = 'xxxxxxxxxxxxx';

// Confirm the names of these Connectors below
let v_GET_Connector='GenericGET';
let v_POST_Connector='GenericPOST';

    LIB CONNECT TO '$(v_POST_Connector)';
    
    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;

	let vLastBearerKey = vBearerKey;

// Connect to the GET library
LIB CONNECT TO '$(v_GET_Connector)';

RestConnectorMasterTable:
SQL SELECT 
	"created_at" AS "created_at_u0",
	"id" AS "id_u4",
	"id_str" AS "id_str_u4",
	"text" AS "text_u3",
	"truncated" AS "truncated_u0",
FROM JSON (wrap on) "root" PK "__KEY_root"
WITH CONNECTION (  
      URL "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=$(vTwitterName)&trim_user=true&count=200$(vMaxTweetURL)",    
      HTTPHEADER "Authorization" "Bearer $(vBearerKey)"
    )
;

 

I've cut some bits out, but this code shows the process for using OAuth, which both Twitter and LinkedIn use.

A post request is made with a key, that stays the same all the time (it's a modified version of the key created on the site) and that then returns a new temporary key.

That temporary key is then peeked out of the first query into a variable. That variable is then passed as a parameter into the load from Twitter.

I've cut out quite a bit around paging and splitting out the data once loaded, but this is likely to be different with LinkedIn, so is not relevant.

Hope that points you in the right direction.

Cheers,
Steve

jabares123
Partner
Partner

Thanks very much, I'll test your idea, your script makes a lot of sense, that it works like this, at least the logic is the same in linkedin with the oauth2 protocol.
I will share my experience with you.

stevedark
MVP
MVP

Hi @jabares123 

That will be great if you can share, as I am sure that there are others who would like to connect to LinkedIn. I looked a while back, but looking at the licence agreement around the API it seems as soon as you try and do anything interesting you are in breach, so I stopped.

I'm happy to assist in getting it working, just make sure you remove any API keys before you share any code (obviously).

Steve