EzDevInfo.com

linkedin

Ruby wrapper for the LinkedIn API Processing linkedin-1.0.0

Social Share Links with Custom Icons

I'm looking for any solid current information on creating custom share icons for the following.

  • Facebook
  • Twitter
  • Google +
  • LinkedIn
  • Pinterest

All the documentation I keep getting to seems to be about using THEIR social like / share buttons - which most of the time I think are not very appealing. Things like socialite.js help to deal with some of the other issues that arrise when using the "native" like / share buttons (sorry not sure what else to call them), but they're not very pretty to be honest.

Any reference material / tutorials or guidance would be awesome.

Cheers.


Source: (StackOverflow)

net/http.rb:560:in `initialize': getaddrinfo: Name or service not known (SocketError)

@@timestamp = nil

def generate_oauth_url
  @@timestamp = timestamp
  url = CONNECT_URL + REQUEST_TOKEN_PATH + "&oauth_callback=#{OAUTH_CALLBACK}&oauth_consumer_key=#{OAUTH_CONSUMER_KEY}&oauth_nonce=#{NONCE}    &oauth_signature_method=#{OAUTH_SIGNATURE_METHOD}&oauth_timestamp=#{@@timestamp}&oauth_version=#{OAUTH_VERSION}"
  puts url
  url             
end

def sign(url)
  Base64.encode64(HMAC::SHA1.digest((NONCE + url), OAUTH_CONSUMER_SECRET)).strip
end

def get_request_token
  url = generate_oauth_url
  signed_url = sign(url)          
  request = Net::HTTP.new((CONNECT_URL + REQUEST_TOKEN_PATH),80)
  puts request.inspect
  headers = { "Authorization" => "Authorization: OAuth oauth_nonce = #{NONCE}, oauth_callback = #{OAUTH_CALLBACK}, oauth_signature_meth    od = #{OAUTH_SIGNATURE_METHOD}, oauth_timestamp=#{@@timestamp}, oauth_consumer_key = #{OAUTH_CONSUMER_KEY}, oauth_signature = #{signed_url}, oauth_versio    n = #{OAUTH_VERSION}" }

  request.post(url, nil,headers)                  
end

def timestamp
  Time.now.to_i
end

I am trying to do what oauth does in an attempt to understand how to use the Authorization headers. I am also getting the following error. I am trying to connect to the linkedin API.

/usr/lib/ruby/1.8/net/http.rb:560:in 'initialize': getaddrinfo: Name or service not known (SocketError)

I would really appreciate it if someone could nudge me in the right direction.


Source: (StackOverflow)

Advertisements

LinkedIn API for Company Directory

I'm trying to use the LinkedIn API to search for companies, not users. I specifically don't want users - only companies.

I had a look at the LinkedIn API Documentation (RTFM and all that), but as far as I can tell it's not supported. There are 2 posts on the forum which pretty much says this outright - here and here

I'm basically just looking for a simply search interface, similar to what is going on on the LinkedIn homepage. I also want to display the info coming back in some way.

Am I better off simply doing a manual GET to the website itself? Would I need to cache the results? Would I need to manually parse the HTML coming back?

I'm planning on implementing this in Ruby, but that's not really what I'm concerned about.


Source: (StackOverflow)

Basic Example of Client Side Templating with Dust.js

This is my first foray into client-side templating and I want to make sure I'm understanding it and using it correctly. After reading this LinkedIn engineering blog, I decided to go with dust.js rather than mustache or handlebars. Note that this stackoverflow post answered many of my questions, but I still have a few things I want to clarify.

In the environment I work in I have no access to anything on the server side, so everything I create has to be able to run entirely in the client's browser. For this example, I'll try to recreate this code sample from the LinkedIn Dust Tutorial.

I include dust-full.js rather than dust-core.js because I'm going to compile the template on the fly:

<script src="js/dust-full.js"></script>

Here is the HTML:

<script id="entry-template">
{title}

<ul>
    {#names}
    <li>{name}</li>{~n}
    {/names}
</ul>
</script>

<div id="output"></div>

And the JavaScript (using jQuery):

$(document).ready(function () {
    var data = {
        "title": "Famous People", 
        "names" : [{ "name": "Larry" },{ "name": "Curly" },{ "name": "Moe" }]
    }

    var source   = $("#entry-template").html();
    var compiled = dust.compile(source, "intro");
    dust.loadSource(compiled);

    dust.render("intro", data, function(err, out) {
        $("#output").html(out);
    });
});

This seems to work fine, as you can see in this jsfiddle.

A couple questions:

  1. Why should the template be contained within script tags? Why not just include it in a div with id="entry-template" and then replace the html inside that during the dust.render(), like in this modified fiddle?

  2. What does "dust.loadSource(compiled);" do? In the docs it says "If you include the 'compiled' string as part of a script block of JS that you load, then the 'intro' template will be defined and registered. If you want to do it immediately then" call it, however I do not understand what that means. I have noticed that if I remove that line then it doesn't work, however, so I'd like to understand it.

  3. After I'm satisfied with my template and finalize it, how should I compile it so that I import the lighter dust-core.js rather than have it be compiled by the browser on every page load? Is there a significant advantage to doing this or should I leave as is with dust-full.js?

  4. More generally, does this look like an appropriate / useful way to implement dust (or any templating framework for that matter) or am I just way off somewhere?

Thanks in advance.


Source: (StackOverflow)

Can't post anything on LinkedIN using linkedin-j

First, my problem is that I can't post any Network Updates, post Shares or Invite by ID. I always get the following exception :

08-29 17:18:04.000: E/AndroidRuntime(4316): FATAL EXCEPTION: main
08-29 17:18:04.000: E/AndroidRuntime(4316): com.google.code.linkedinapi.client.LinkedInApiClientException: Access to posting network updates denied.
08-29 17:18:04.000: E/AndroidRuntime(4316):     at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.createLinkedInApiClientException(BaseLinkedInApiClient.java:3906)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.callApiMethod(BaseLinkedInApiClient.java:3846)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.postNetworkUpdate(BaseLinkedInApiClient.java:1172)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at pl.osadkowski.LITest.LITestActivity.onNewIntent(LITestActivity.java:61)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1123)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at android.app.ActivityThread.deliverNewIntents(ActivityThread.java:2042)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at android.app.ActivityThread.performNewIntents(ActivityThread.java:2055)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at android.app.ActivityThread.handleNewIntent(ActivityThread.java:2064)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at android.app.ActivityThread.access$1400(ActivityThread.java:123)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1194)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at android.os.Looper.loop(Looper.java:137)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at android.app.ActivityThread.main(ActivityThread.java:4424)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at java.lang.reflect.Method.invokeNative(Native Method)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at java.lang.reflect.Method.invoke(Method.java:511)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-29 17:18:04.000: E/AndroidRuntime(4316):     at dalvik.system.NativeStart.main(Native Method)

Secondly, What have I tried? Well, I'm sure I haven't tried EVERYTHING or else it would be working but I feel like I exhausted all possibilities. SOME of the things I have tried to no avail :

https://developer.linkedin.com/documents/authentication#granting

http://stackoverflow.com/a/10872824/1436210

http://code.google.com/p/linkedin-j/source/browse/trunk/linkedin-j/core/src/examples/java/com/google/code/linkedinapi/client/examples/PostNetworkUpdateExample.java?r=197

http://code.google.com/p/linkedin-j/wiki/GettingStarted

http://code.google.com/p/linkedin-j/wiki/AndroidConfiguration

I really hope someone can help!! I'll try anything!! Thanks a million!


Source: (StackOverflow)

Keep url encoded while using URI class

I'm trying to get public profile information from LinkedIn. To achieve this I have to provide
http://api.linkedin.com/v1/people/url=public-profile-url, where public-profile-url MUST be URL encoded.

The issue is that .NET classes such as HttpClient, WebRequest etc use Uri class which seems to "canonize" the provided URL, so that I can't get the proper formatted request sent.

The URI must be:

h ttp://api.linkedin.com/v1/people/url=http%3a%2f%2fwww.linkedin.com%2fin%2fiftachragoler

but is:

http://api.linkedin.com/v1/people/url=http://www.linkedin.com/in/iftachragoler

In this way, I get 'Bad Request' from LinkedIn.

Is there any way I can have Uri/UriBuilder not to decode that URL?

Thanks!


Source: (StackOverflow)

LinkedIn OAuth Exception Scope NOT_AUTHORIZED r_fullprofile

Everything worked well until today when I received an email from LinkedIn indicating some significant API changes. And subsequently I was seeing Exceptions while authenticating users via. LinkedIn.

Following is the exception from logs

OAuth::Problem (Scope NOT_AUTHORIZED : r_fullprofile):
  oauth (0.4.7) lib/oauth/consumer.rb:178:in `request'
  oauth (0.4.7) lib/oauth/consumer.rb:194:in `token_request'
  oauth (0.4.7) lib/oauth/consumer.rb:136:in `get_request_token'

OAuth logic to get request token.

consumer = OAuth::Consumer.new(LINKED_IN_API_KEY, LINKED_IN_SECRET_KEY,
                 {
                   :site               => "https://api.linkedin.com",
                   :scheme             => :header,
                   :http_method        => :post,
                   :request_token_path => "/uas/oauth/requestToken?scope=r_fullprofile",
                   :access_token_path  => "/uas/oauth/accessToken",
                   :authorizeEmapath     => "/uas/oauth/authorize"
                 })

### Exception occurs at this call.
request_token = consumer.get_request_token(:oauth_callback => callback_url)

Email from LinkedIn

enter image description here

My Analysis till now

If I change the scope to r_basicprofile it works fine but then I don't get skills info of the authenticated linkedin user.

What should be the additional changes I need to do to suffice the API change ?


Source: (StackOverflow)

Oauth 2.0 authorization for LinkedIn in Android

Even though there is no such android specific sdk from linkedIn(like facebook and twitter sdk for android).Setting up linkedIn authorization with Oauth 1.0 was still easy using:

But its not the same story for authorization with Oauth2.0. Not too many usefull libraries or android specific examples. I tried using these:

I have read that Oauth 2.0 is much simpler to implement than the 1.0. Still I am not able to do so.

Any pointers towards implementing Oauth2.0 for LinkedIn in Android?


Source: (StackOverflow)

Derive LinkedIn profile URL from API user token?

The LinkedIn API refers to users by alphanumeric member token instead of numeric ids.

Is it possible to derive a linkedin profile url (public OR private) from the user token?

(Info: https://developer.linkedin.com/comment/4173#comment-4173)


Source: (StackOverflow)

linkedin button dynamic rendering

How to render linkedin button in a dynamic way? e.g. writing the "<script type='in/share'></script>" at runtime or after the page has finished loading. I already tested on writing it or appending it in the body tag using jquery but it doesn't work. I'll appreciate any help. thanks.


Source: (StackOverflow)

LinkedIn API : Logout form LinkedIn API

I have worked with LinkedIn Api and need guidance about logging out from Linkedin Api once I click Logout in my application screen. I have tried the following code:

function closeSession(){
    IN.User.logout();
}
<a rel='nofollow' href="logout.php" class="myButton" onclick="closeSession()" id="logout-link">Logout In LinkedIn</a>

and also I have tried the following code too.:

$('logout-link').click(function() {  
    IN.Event.on(IN,'logout', function() {
        window.location.href = [site-logout-url];
    });
    IN.User.logout();
});

and also tried to destroy the session in a browser by calling session_destroy()

also tried the answer I got from stack overflow for this question . I didnt get any right solution , so any one please tell me the solution....


Source: (StackOverflow)

Verified email from LinkedIn API?

Is the email address returned from your public API guaranteed to be verified? "email-address" accessible via the "r_emailaddress" member permission here: https://developer.linkedin.com/docs/fields/basic-profile.


Source: (StackOverflow)

how friend suggestions or 2nd degree related (linkedin) algorithm works

I've been thinking about facebook suggestions and other similar system of linkedin.

I think Facebook suggestion also based personal knowledges, like school years, the companys i worked or something similar.

But beyond that to be more specific here is the scheme facebook suggestion scheme

Case1 looks simple, but when the friend count goes bigger (event about 300 friend too much) it's not efficient. How about Case2? What kind of algorithm can do this work.

I've no idea about Case3 because i guess its something special fo facebook. but how could i detect person 4. is which degree related?


Source: (StackOverflow)

IE "Cannot Display the webpage" appearing in browser history

I have developed a website where the "back" button does not always go back to the previous page when using IE - no issue with Firefox or Chrome. It seems that for certain page changes, IE cannot initially display the page, and then successfully loads it, but the initial failure appears in history.

Then when you hit "back" it first goes back to the error entry (though nothing changes on screen) and then a second hit of the button takes you back a page.

Cannot display webpage

I don't see the same behaviour on firefox, and I am not doing any redirects in the page transitions, and the only .htaccess rule I have is for FURL, which is a direct re-write, no redirects:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Can anyone suggest an approach to finding out what IE didn't like on the page, that would cause this to happen?

The same behaviour is happening in IE7 and IE9.

Update: I think I have isolated this to linkedin plugins. These are used throughout the site. Pages that do not have any plugins work as expected, nothing weird in history. On some pages I have the "Follow Us" plugin:

<script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
<script type="IN/FollowCompany" data-id="568783" data-counter="none"></script>

And these have a single "Cannot Display Page" in the history once you go to the page. On another page, I have 6 plugins called, to populate a team page with 5 profiles from linkedin, and a Follow Us plugin. Each call to linkedin results in a "cannot display this page" in the history:

enter image description here

Any ideas why this would happen?


Source: (StackOverflow)

How to successfully implement og:image for the LinkedIn

THE PROBLEM:

  • I am trying, without much success, to implement open graph image on site: http://www.guarenty-group.com/cz/
  • The homepage is completeply bypassing the og:image tag, where internal pages are reading all images from the site and place og:image as the last option.
  • Other social networks are working fine on both internal pages and homepage.

THE CONFIGURATION:

  • I have no share buttons or alike, all I want is to be able to share the link via my profile.
  • The image is well over 300x300px: http://guarenty-group.com/img/gg_seal.png
  • Here is how my head tag looks like:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>Guarenty Group : Pojištění pro nájemce a pronajímatelé</title>
    
            <meta name="keywords" content="" />
            <meta name="description" content="Guarenty Group pojišťuje příjem z nájmu pronajímatelům, kauci nájemcům - aby nemuseli platit velkou částku v hotovostí předem - a dále nájemcům pojišťuje příjmy, aby měli na nájem při nemoci, úrazu či nezaměstnání." />
            <meta name="image_src" content="http://guarenty-group.com/img/gg_seal.png" />
            <meta name="image_url" content="http://guarenty-group.com/img/gg_seal.png" />
    
            <meta property="og:title" content="Pojištění pro nájemce a pronajímatelé" />
            <meta property="og:url" content="http://guarenty-group.com/cz/" />
            <meta property="og:image" content="http://guarenty-group.com/img/gg_seal.png" />
            <meta property="og:description" content="Guarenty Group pojišťuje příjem z nájmu pronajímatelům, kauci nájemcům - aby nemuseli platit velkou částku v hotovostí předem - a dále nájemcům pojišťuje příjmy, aby měli na nájem při nemoci, úrazu či nezaměstnání [...]" />
            ...
    </head>
    

THE TESTING RESULTS:

In order to trick the cache i have tested the site with http://www.guarenty-group.com/cz/?try=N, where I have changed the N every time. The strange thing is that images found for different value of N is different. Sometimes there is no image, sometimes there is 1, 2 or 3 images, but each time there is a different set of images. But, in any case I could not find the image specified in the og:graph!


MY QUESTIONS:

  1. https://developer.linkedin.com/documents/setting-display-tags-shares is saying one thing, and the personnel on the support forum is saying "over 300" Does anyone know What is the official minimum dimension of the image (both w and h)?
  2. Can an image be too large?
  3. Should I use the xmlns, should I not use xmlns or it doesn't matter?
  4. What are the maximum (and minimum) lengths for og:title and og:description tags?

Any other suggestion is of course welcomed :)

Thanks in advance, cheers~


Source: (StackOverflow)