restoauth-2.0linkedin-api

Can I get the company name/logo with the LinkedIn API?


If I have a LinkedIn organization id, like 123456 can I get the company name or logo?

I can see that it could be done in the previous API: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/organization-lookup-api

GET https://api.linkedin.com/rest/organizations/{organization ID}

But it is through the 2-legged OAuth flow.

I tried to create a ticket on zendesk, but I got the following response:

Please note most of our API calls run through 3-legged authorization. We are not assigning 2-legged auth for any of our partners and is not available for any marketing use cases.

Is there an another way to have access to 2-legged auth token? When I try to create a token for my app on this page: https://www.linkedin.com/developers/tools/oauth/token-generator the option for 2-legged is greyed out.

Is it impossible now, to find a linkedin company based on the id? I know that https://www.linkedin.com/company/123456 will redirect to the company page, but I would like an automated solution.


Solution

  • I'm not sure what you mean by 'only 2-legged', but as the customer support told you, almost every endpoint that is available as of now, supports 3-legger OAuth2 flows.

    That said if you want to retrieve an organization's basic data - which by the way do include profile picture and name - you need to use the organizationsLookup endpoint, passing your Bearer access token (3-legged, of course) in the authorization field of your GET request.

    Lookup organizations

    The request should be formatted like this: https://api.linkedin.com/rest/organizationsLookup?ids=94808959.

    In case you need to pass more than one id, you can do it by using the List(id1,id2,...) parameter (.../organizationsLookup?ids=List(id1,id2))

    Here's a sample response:

    {
        "results": {
            "94808959": {
                "vanityName": "inpilotai",
                "localizedName": "inpilot",
                "name": {
                    "localized": {
                        "en_US": "inpilot"
                    },
                    "preferredLocale": {
                        "country": "US",
                        "language": "en"
                    }
                },
                "primaryOrganizationType": "NONE",
                "locations": [],
                "id": 94808959,
                "localizedWebsite": "https://inpilot.ai",
                "logoV2": {
                    "cropped": "urn:li:digitalmediaAsset:D4D0BAQGEQMEdfTdtNA",
                    "original": "urn:li:digitalmediaAsset:D4D0BAQGEQMEdfTdtNA",
                    "cropInfo": {
                        "x": 0,
                        "width": 0,
                        "y": 0,
                        "height": 0
                    }
                }
            }
        },
        "statuses": {
            "94808959": 200
        },
        "errors": {}
    }
    

    https://api.linkedin.com/rest/organizationsLookup?ids=94808959

    Last thing: you'll need to specify an API version in the header. For the example above I used the Linkedin-Version: 202209.

    At the following link, you can find the documentation example to learn more about how the entire organization lookup API system works.

    https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/organization-lookup-api?view=li-lms-2023-06&tabs=http#sample-response-1