Happyr / LinkedIn-API-client

A library to connect with LinkedIn API. Perfect if you are looking for an API client or SDK for LinkedIn
MIT License
198 stars 97 forks source link

remove the host part of the url if it has been passed in as part of $… #149

Closed DavidGoodwin closed 1 month ago

DavidGoodwin commented 6 years ago
Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Related tickets none
License MIT

What's in this PR?

If someone passes e.g. https://api.linkedin.com/v2/whatever in as the resource parameter, then the underlying code will try and request https://api.linkedin.com/https://api.linkedin.com/v2/whatever ... which unsurprisingly doesn't work.

Why?

I wasted some time wondering why it wasn't working ....

Example Usage


$x = new LinkedIn();
// setup.

var_dump($x->get('https://api.linkedin.com/v2/adAccountsV2')) ; // now works.
Nyholm commented 6 years ago

Thank you for this PR. Could you tell me why this is needed? What if we update the documentation to be extra clear that one should use the path as parameter?

DavidGoodwin commented 6 years ago

Oh - I was trying to use one of the V2 APIs, and was just pasting in the URL from the page (see e.g. https://developer.linkedin.com/docs/guide/v2/ads/create-and-manage-accounts) as the resource.

If you can document it then fine.