LinkedIn Companies API无Logo企业返回500错误问题咨询
I’ve run into this exact quirk with the LinkedIn v1 API before—when you request the logo-url field for a company that hasn’t uploaded a logo, the API throws a 500 internal server error instead of gracefully returning null or omitting the field. Here are practical ways to resolve this:
Immediate Workaround: Remove the logo-url Field
If you can temporarily do without company logos, simply exclude the logo-url parameter from your fields list. This will let the API return valid data for all companies, including those missing logos.
Modified curl request example:
curl "https://api.linkedin.com/v1/companies:(id,name,universal-name,website-url,industries,status,blog-rss-url,twitter-id,employee-count-range,specialties,locations,description,stock-exchange,founded-year,end-year,num-followers)?is-company-admin=true&format=json&count=1&start=2&oauth2_access_token=XXXX"
Better Long-Term Solution: Migrate to LinkedIn API v2
The v1 API is deprecated and unmaintained, which is why you’re seeing this unhandled error. LinkedIn’s v2 API handles missing fields far more gracefully—it returns null for logoUrl (note the camelCase naming in v2) instead of crashing with a 500.
To get started with v2, use the organizationalEntityAcls endpoint to retrieve companies you’re an admin of, then fetch details via the organizations endpoint. Example of a v2 company details request:
curl "https://api.linkedin.com/v2/organizations/{ORG_ID}?fields=id,name,vanityName,websiteUrl,industries,status,rssUrl,logoUrl,twitterHandle,employeeCountRange,specialties,localizedDescription,stockExchange,foundedYear,endYear,followerCount" -H "Authorization: Bearer XXXX"
Alternative: Handle Errors and Fetch Companies Individually
If you must stay on v1 and need logo data:
- First fetch all company IDs without including
logo-url - Make individual requests for each company ID, adding
logo-urlto the fields list - Catch the 500 error for specific companies and treat them as having no logo
This is more labor-intensive, but it lets you retain logo data where it exists while avoiding batch failures.
Note: LinkedIn may shut down the v1 API entirely at any point, so migrating to v2 is strongly recommended to avoid future disruptions.
内容的提问来源于stack exchange,提问作者Rishikesan Varudharajan

