Unable to get companies for LinkedIn API version V2 - linkedin

I use the Zoonman LinkedIn API PHP SDK to get information about companies an authenticated user is an admin of, using this bit of code:
$profileCompany = $client->get(
'companies',
['is-company-admin' => "true"]
);
This worked perfectly with API version V1. However, with V2, it gives a 400 not found error. I came across this: Organization Lookup API but not exactly sure if this is the right endpoint, as there is no API call to exactly do what the above code snippet does.
Could someone please help with the right endpoint?

If you have the access token from the user this is possible in v2 of the LinkedIn API. See:
https://developer.linkedin.com/docs/guide/v2/organizations/organization-lookup-api#acls
The full URL for the basic request would be:
https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&state=APPROVED&projection=(*,elements*(*,organizationalTarget~(*)))
With paging:
https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&state=APPROVED&projection=(*,elements*(*,organizationalTarget~(*)))&start=[...]&count=[...]
And you probably want the organization logo urls as well:
https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&state=APPROVED&projection=(*,elements*(*,organizationalTarget~(*,logoV2(original~:playableStreams,cropped~:playableStreams,cropInfo))))&start=[...]&count=[...]
For linkedin-api-php-client see also:
https://github.com/zoonman/linkedin-api-php-client/issues/31

From the docs
Please note the following changes when migrating your app from v1 of
the LinkedIn API Platform:
Company Pages and Showcase Pages are now
surfaced as Organization and Brand resources, respectively. Both
resources are considered "Organizational Entities," and share common
fields and similarities in how data is accessed.
URNs uniquely
identify organizational entities, and can be generated with existing
company or showcase ids:
Organization: urn:li:organization:{company id}
The above code make call the rest api "List all companies that the member is an administrator of". It does not seems have a direct equivalent API available in v2.
Organisation lookup/search APIs seems nearest alternative.
Hope this helps.

Related

LinkedIn API v2 how to use r_basicprofile for fields?

It's January 2019. I'm migrating to LinkedIn API v2, as LinkedIn requires.
My app has set up && been granted (by user clicks) these permissions shown in this picture.
The simplest API call is GET "/v2/me" with no extra query string, which returns data in this shape:
"{\"lastName\":{\"localized\":{\"en_US\":\"Jobs\"},\"preferredLocale\":{\"country\":\"US\",\"language\":\"en\"}},\"firstName\":{\"localized\":{\"en_US\":\"Steve\"},\"preferredLocale\":{\"country\":\"US\",\"language\":\"en\"}},\"profilePicture\":{\"displayImage\":\"urn:li:digitalmediaAsset:X9999XXXX5-XXx9-bye\"},\"id\":\"XyyyyXXXXX\"}"
But I wish to ask for more fields (all of which are allowed once I have r_basicprofile as mentioned https://developer.linkedin.com/docs/ref/v2/profile/basic-profile) by GET "/v2/me?fields=id,firstName,lastName,headline,profilePicture",
but received:
"{\"serviceErrorCode\":100,\"message\":\"not enough permissions to access field headline for GET /me\",\"status\":403}"
Indeed https://developer.linkedin.com/docs/guide/v2/people/profile-api did NOT say /v2/me
can have query string like ?fields=id,firstName,lastName,headline,profilePicture. If this query string is not allowed right now. what am I benefiting from r_basicprofile?
I have also tried GET "/v2/people/(id:{person ID})", which got
"{\"serviceErrorCode\":100,\"message\":\"Not enough permissions to access: GET /people/(id:XyyyyXXXXX)\",\"status\":403}"
Before 1st March You have to Move in V2
r_basicprofile is there because you can use this with V1 till 1st march
after that this will automatically deleted
in V2 you have to use :
r_liteprofile for firstName,lastName,profilePicture,id - https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,profilePicture(displayImage~:playableStreams))
r_emailaddress for getting emailAddress - https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))
From the documentation, in addition to updating your scope to r_liteprofile, you would have to change the API endpoint from people/~:(id,firstName,lastName) to me?projection=(id,firstName,lastName) to get the basic profile details.

Endpoint / API Key for Microsoft Academic Knowledge

I'm trying to use the MS Academic Knowledge API. I signed up for keys here as per the docs
https://labs.cognitive.microsoft.com/en-US/sign-up
When I use the key I get errors as follows
api.labs.cognitive.microsoft.com:
Endpoint api.labs.cognitive.microsoft.com is not supported
westus.api.cognitive.microsoft.com:
'Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key.'
I'm not sure what is going on here and which endpoint I need to use
The following works for me:
https://api.labs.cognitive.microsoft.com/academic/v1.0/interpret?query=darrin%20eid&complete=1&count=10&model=latest&subscription-key=your_key
(replace "your_key" with your labs subscription key)
Additionally, you can see the URL you need to use for each different API when you use the "try it" test site

How to make LinkedIn V2 Share (SocialActions) work correctly?

We recently obtained the r_ad_campaigns permission to work with the LinkedIn V2 API:
https://developer.linkedin.com/docs/lms/marketing-analytics/quick-start#
https://developer.linkedin.com/docs/guide/v2/shares/network-update-social-actions
To work correctly, I have obtained a new TOKEN with the new permission: r_ad_campaigns
I have made the following 3 calls with this new token:
https://api.linkedin.com/v2/socialActions/{share URN}?oauth2_access_token=TOKEN
https://api.linkedin.com/v2/socialActions/{share URN}/comments?oauth2_access_token=TOKEN
https://api.linkedin.com/v2/socialActions/{share URN}/likes?oauth2_access_token=TOKEN
And they all return the same result:
{"serviceErrorCode": 100, "message": "Not enough permissions to access: GET / socialActions / {share URN}", "status": 403}
The same thing happens with these post:
Why does LinkedIn v2 Share API give not enough permissions error on any v2/shares endpoint?
LinkedIn V2 API permission for reading socialActions and Shares
Please, does anyone know how to solve this problem and that it works correctly? Is it important.
It's working in my case, this problem related to permission
Follow these steps,
Open Url, https://www.linkedin.com/developers/apps/
Goto products
Select all products
Marketing Developer Platform Product need some days to be approved
If all products are successfully installed
Check OAuth 2.0 scopes permissions to access data using your app

Are there new facebook restriction for Rfacebook package?

I want to get some data from Facebook, so I wanted to create application to get token for 60 days like I did few months ago. Then everything worked well, I just followed steps from the tutorial like this:
http://thinktostart.com/analyzing-facebook-with-r/
So It was enough to create "empty" application, write in R with proper id and secret
fb_oauth <- fbOAuth(app_id="123456789", app_secret="1A2B3C4D",extended_permissions = TRUE)
fill website page as http://localhost:1410/ and autenthication was complete and I was able to make get some data from facebook. It seems that it is not so easy anymore.
When I try to follow exactly the same steps it seems that now I have to fill in my application (with some description, photos...) and "send" it to submission.
Do you have similar problem or I just miss something? I just want to use information from facebook for my own use, not for business or something. Is there any (other) way to get a token for R which allows me to get some information from Facebook without filling application. I don't think that filling it with some fake data will pass facebook verification.
I just want to use information from facebook for my own use
Then you don’t need to submit it for review.
See https://developers.facebook.com/docs/apps/faq#roles – it explains that you can ask any user that has a “role” in the app (meaning admin, developer or tester) for any permission without prior review.
For one, this is of course implemented this way, so that people can actually test the functionality they are developing properly. And it is also an “official loophole” for apps such as yours, that are for “private use” only, and not meant to be used by the general public in the first place.
(And this has nothing whatsoever with the Rfacebook package – it is the same for all apps, no matter what framework/SDK they might be using.)
UPDATE
As #CBroe said earlier, you do not need an approved app, you just need to add the users of the app as admin in the app's role menu in Facebook Developers.
Follow these steps and you will get your permanent FB token:
Create new application at https://developers.facebook.com/apps/ with basic setup
Fill in the app name in lower case and without the words Facebook or FB for display name and namespace, category set to Business
In "Settings/Basic" I added a new "Website" platform with the URL of http://localhost:1410/ and localhost as the "App Domain"
In the "Settings/Advanced" tab I added http://localhost:1410/ as the Valid OAuth redirect URIs
Then, run this code:
library(httr)
app <- oauth_app('facebook', appid, appsecret)
Sys.setenv("HTTR_SERVER_PORT" = "1410/")
tkn <- oauth2.0_token(
oauth_endpoints('facebook'), app, scope = c('ads_management', 'read_insights'),
type = 'application/x-www-form-urlencoded', cache = FALSE)
save(tkn, file = "~/Documents/RFiles/fb_token") # save the token for future use
Make sure you put 'read_insights' in scope, otherwise you are not telling Facebook what kind of permissions you want the app to take.
Finally you can use the token:
library(Rfacebook)
load("~/Documents/RFiles/fb_token")

Not getting company info

I am new to this linkedin api. I have made a small example which is working when I am using the keyword search by using the following url:
https://api.linkedin.com/v1/company-search:(companies:(id,name,universal-name,website-url,industries,status,logo-url,blog-rss-url,twitter-id,employee-count-range,specialties,locations,description,stock-exchange,founded-year,end-year,num-followers))?keywords={IBM}&oauth2_access_token=<access Token>
But when I am searching any company info by using the email-domain search then it is giving me 403 error:
<error>
<status>403</status>
<timestamp>1432820120642</timestamp>
<request-id>XLWN5Y7T7R</request-id>
<error-code>0</error-code>
<message>Member 385883298 does not have permission to get company 66028</message>
</error>
I am using the following url for this:
https://api.linkedin.com/v1/company-search:(companies:(id,name,universal-name,website-url,industries,status,logo-url,blog-rss-url,twitter-id,employee-count-range,specialties,locations,description,stock-exchange,founded-year,end-year,num-followers))?email-domain=ibm.com&oauth2_access_token=<acess Token>
So as you have posted your answer which is related to this problem I guess you are saying that I have to be the administrator for the company page for which I am searching. As like in my above url i.e. email-domain=ibm.com. If I am wrong or not getting the things, please guide me.
Thanks
As part of the recent changes to the LinkedIn API - you are required to be the administrator of the company you are making API calls on behalf of. As a result, the company search calls are no longer openly available.
You can make a call to check whether the authenticated user is an Administrator of a given company like this:
https://api.linkedin.com/v1/companies/{Insert CompanyID here}/relation-to-viewer/is-company-share-enabled?format=json
This will return a boolean value. If true, you're good to go. If false, you'll need to get an existing company admin to grant the user company administrator status using the tools available on www.linkedin.com

Resources