Joe F.
Joe F.

Reputation: 867

LinkedIn API - Company query does not return State and Country values

I am using the python-linkedin library to access the LinkedIn api, with the primary purpose of retrieving data from specific company pages. I can successfully identify the company ID and retrieve some information, but the problem is that the response does not contain State or Country information.

The official docs show that the response should contain - locations:(address:(state)) - locations:(address:(country-code))

...but this is not the case. Even the official examples of the XML response, no state or country data is shown:

<location>
  <address>
    <street1>30 S. Wacker Drive</street1>
    <city>Chicago</city>
    <postal-code>60606</postal-code>
  </address>
  <contact-info>
  </contact-info>
</location>

I have gone through a bunch of test cases, and every time the company page has included a state and country value, but the response does not include this data.

My test case, on LinkedIn, and via python-linkedin:

>>>company = auth.get_companies(company_ids=['834495'], selectors=['id','name','locations'])

>>>company {u'_total': 1, u'values': [
                     {
                      u'_key': u'834495', 
                      u'id': 834495, 
                      u'name': u'RingLead, Inc.', 
                      u'locations': {
                           u'_total': 2, u'values': [
                                 {
                                  u'contactInfo':{
                                      u'fax': u'', 
                                      u'phone1': u'888-240-8088'
                                      }, 
                                  u'address': {
                                      u'postalCode': u'11743', 
                                      u'city': u'Huntington', 
                                      u'street1': u'205 East Main Street'
                                      }
                                  }, 
                                  {
                                  u'contactInfo': {
                                     u'fax': u'', 
                                     u'phone1': u''
                                     }, 
                                  u'address': {
                                     u'postalCode': u'89117', 
                                     u'city': u'Las Vegas', 
                                     u'street1': u'3080 South Durango, Ste.102'
                                     }
                                   }
                              ]
                           }
                       }
                    ]
               }

Is this a design choice by LinkedIn, or is it possible to update the API to provide this information in the response?

Upvotes: 3

Views: 445

Answers (1)

Ilialuk
Ilialuk

Reputation: 364

Enter in the locations selector the following field -

{'locations' : {'address' : 'country-code'}}

In total a selector field would look like this:

selectors=[{'companies': [{'locations' : {'address' : 'country-code'}}, 'name', 'universal-name', 'website-url']}]

It's amazing how LinkedIn's documentation is bad, as if they're trying to make it hard on the developers.. smh

Upvotes: 0

Related Questions