I’m trying to access out-of-network profiles using the LinkedIn API, following the instructions from here.
I’m writing my code in Python.
As I understand it, I just add an extra header to my HTTPSConnection request:
normal call:
connection.request(method, relative_url, body = body, headers={‘Authorization’: OAuth_header})
out-of-network call:
// these values were extracted from the http-header I received
name = x-li-auth-token
value = name:R8Y4
connection.request(method, relative_url, body = body, headers={‘Authorization’: OAuth_header, name: value})
When I do the out-of-network call, I get an error:
error:
status: 401
timestamp: 1330027911625
request-id: VHUSL0J7TL
error-code: 0
message: [unauthorized]. OAU:k1tofeoqr4id|2dc38f4e-73d1-4d31-9330-dd82aca89616|*01|*01:1330027911:CRc7YYYQRe2VS6woJpGX+qYVa/Q=
I’ve been testing this on both my own profile and an actual out-of-network profile, no change in error.
From various API requests, the “value” changes slightly, and I have tried all variants:
“name:R8Y4”
“search-name:R8Y4”
“OUT_OF_NETWORK:R8Y4”
I’m guessing it has to do with the HTTP headers, but I have no idea what is wrong.
Please help! Thank you.
I’m not sure why your call is failing. Here’s the sequence using the tested oauth2 library in python, including the entire HTTP conversation.
First, do the search:
http://api.linkedin.com/v1/people-search:(people:(distance,id,first-name,last-name,headline,api-standard-profile-request))
Second call, to get the profile:
http://api.linkedin.com/v1/people/UBAQYFeiHo:(id,first-name,last-name)
The python code to make the second part work with the oauth2 library is: