linkedin icon indicating copy to clipboard operation
linkedin copied to clipboard

client#companies requests incorrect URL when :is_admin and :fields options are set

Open hundredwatt opened this issue 12 years ago • 1 comments

This was discovered on v0.4.6

When I use the #companies method like so, I get an Exception:

1.9.3-p484 :001 > client.company(is_admin: 'true', fields: %w(id name universal-name email-domains company-type))
=> LinkedIn::Errors::GeneralError: (400): URL must contain a valid resource type

I used HTTPLogger to see what url was being requested:

 HTTP GET (267.90ms)   https://api.linkedin.com:443/v1/companies?is-company-admin=true:(id,name,universal-name,email-domains,company-type)

This is incorrect. It should be: https://api.linkedin.com:443/v1/companies:(id,name,universal-name,email-domains,company-type)?is-company-admin=true

Workaround:

1.9.3-p484 :001 > client.send(:get, '/companies:(id,name,universal-name,email-domains,company-type)?is-company-admin=true')
=> "{\n  \"_total\": 1,\n  \"values\": [{\n    \"companyType\": {\n      \"code\": \"P\",\n      \"name\": \"Privately Held\"\n    },\n    \"emailDomains\": {\n      \"_total\": 1,\n      \"values\": [\"gaggleamp.com\"]\n    },\n    \"id\": 1585351,\n    \"name\": \"GaggleAMP\",\n    \"universalName\": \"gaggleamp\"\n  }]\n}"
1.9.3-p484 :001 > LinkedIn::Mash.from_json _
=> {"total"=>1,
 "all"=>...

hundredwatt avatar Feb 05 '14 20:02 hundredwatt

nicee!

dfrancisc avatar Jul 01 '14 13:07 dfrancisc