emorikawa / linkedin-oauth2

Ruby wrapper for the LinkedIn OAuth2 API
Other
70 stars 86 forks source link

HTTP 400 on Companies API calls #34

Open danielbonnell opened 8 years ago

danielbonnell commented 8 years ago

Hello,

I just set up this gem in my app to replace the hexgnu linkedin gem so that I could pull in metrics on posts that my users send out. I'm finding it impossible to access the companies API though. Any time I attempt to call a method for that API, I get an HTTP 400 error. I saw Issue #31 but I don't think that's the problem, as I am an administrator on the pages whose posts I am trying to pull metrics on. Additionally, since upgrading I've lost the ability to create new shares. I've tried the following methods, all of which return 400 errors:

add_company_share
company_updates_comments
company_updates_likes

I wouldn't be surprised if other methods also returned 400 errors. I'm rather desperate to get this to work as my attempts at using other gems to get metrics on company shares have failed. I've also not had any success creating an integration from scratch.

Edit: I also noticed Issue #11, which pertains to add_company_share, but that didn't solve my problem.

Thanks!

MattRyder commented 7 years ago

I'm logging this here for future use, in case anyone else hits a similar issue, and I'd like to offer up my solution.

Firstly, this gem's logging features are (IMO) impossible, if you're hitting any issues go ahead and drop the faraday logging middleware until you've sussed your issue, it obscures (quite helpful) errors from the LinkedIn API. To do that, you need to comment out raise_error.rb#L16 and connection.rb#L20.

I've also found that if you're trying to do, for instance, api.company(is_admin: true) it'll fail because it actually expects a string value - api.company(is_admin: "true").

Hope some of this helps.

@emorikawa: Man, please support this gem if you can, or put out a request for a maintainer (you've got a good dozen downstream forks, i'm sure some folks can chip in). You've got a great piece of code here, and it's falling by the wayside.