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

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

Related

LinkedIn Api issue

Im trying to use linkedin API’s
In specific simpleJobPosting ( which is like i read in the documentation its an api that is used to create a post on linkedIn profile )
I followed all the steps ,, created an app on the linkedIn portal and got ClientId and ClientSecret ,, I’ve generated an access token and verified the organization that I selected,, also i selected the suitable scope before generating an access token (w_member_social)
when I tested it on PostMan I still got an error which is said
U don’t have enough permission to access Post/simpleJobPosting with status 403 and error code 100
I checked the documentation for the error status and said ensure that the header x-restli-method with value batch_create is present and i already included it in the headers and all the other steps
any suggestions ??
step1-As shown here i created an app and got clientId,ClientSecret
step2-i selected the suitable scope(permission)
step3-i've generated an access token
step4-verified the company that i've selected
step5-postman request details

Migration to Version 2.0 of LinkedIn API

Recently I created an application for the LinkedIn API (Status is Development).
I managed to do requests to the old v1 version of the API, for example 'https://api.linkedin.com/v1/people/~' and '/v1/people/~/shares'. But when I try to use the new version, v2, of the API I encounter some problems.
Problem 1: When I try to request 'https://api.linkedin.com/v2/me' I get the following error:
{
"serviceErrorCode": 100,
"message": "Not enough permissions to access: GET /me",
"status": 403
}
From what I understand to fix this problem I should use the 'r_liteprofile' scope when requesting a access token. But this leads to my next problem.
Problem 2: When I request the oauth endpoint (https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id={id}&redirect_uri={redirect_uri}&state={state}&scope=r_liteprofile) I get the following error:
error=unauthorized_scope_error&error_description=Scope "r_liteprofile" is not authorized for your application
So I figured I need to select these scopes in the Application settings. But that leads to my third and final problem.
Problem 3: I am unable to select the required application permissions at 'https://www.linkedin.com/developer' for my application.
My Default Application Permissions
How do I manage to use the new (v2) API version?
Thanks!
For moving first you check :
you have to check Linkedin - Myapp - Default Application Permissions
You have r_liteprofile permission or not ( for calling this 'https://api.linkedin.com/v2/me)
in V2 you can use : r_liteprofile for firstName,lastName,profilePicture,id r_emailaddress for getting emailAddress
Check this : https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq?context=linkedin/consumer/context

Unable to get companies for LinkedIn API version V2

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.

Linkedin access token doesn't work on v2 api

I followed the instructions directly from Linkedin's V2 API Documentation to get an access token and then try to get basic user information through the endpoint https://api.linkedin.com/v2/me , but it simply returns the following error:
{
"serviceErrorCode": 100,
"message": "Not enough permissions to access /me GET ",
"status": 403
}
I try to use the same code to the version 1 of the API equivalent (https://api.linkedin.com/v1/people/~?format=json) and it works.
Both the v1 and v2 documentation redirects to the same url (https://developer.linkedin.com/docs/oauth2), that makes sense because both authenticates via OAuth 2.0.
I review the permissions of my app and they looks good (I tried with r_basicprofile, * r_emailaddress*, both of them, and also with all the permissions availables both explicit when I request the access the authorization code and in the application settings in Linkedin Dashboard).
I would like to know if there is something that I'm missing or that I'm doing wrong in the process to make this work.
LinkedIn API is private. You have to request authorization from them at https://business.linkedin.com/marketing-solutions/marketing-partners/become-a-partner/marketing-developer-program (or one of their other programs).
If you authenticate with v2 using r_basicprofile(following this https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/consumer/context) you are not allowed to query against https://api.linkedin.com/v2/me but can query on https://api.linkedin.com/v1/people/~.
To query against https://api.linkedin.com/v2/me you must authenticate using r_liteprofile.

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