Not-Exploring APIs

Published on Monday 12 August 2019 | 1 minute read

I've just have an interesting trip down the rabbit hole of social media APIs.

Yesterday is discovered that Twitter's is a bit of a mess. Today I discovered that LinkedIn's is basically non existent. This is a bit of disappointment - I can't even get my own number of followers out of it. From TechCrunch:

The company effectively limited a number of integrations to only two major partners, Microsoft and Salesforce, last year, and they clearly want to direct more traffic to LinkedIn itself, where user engagement is much more likely to result in actual revenue.

GitHub's API is, as you'd expect, is excellent. But my goal with this was to be able to create engagements for social organisations with their social media accounts and have easy access to how their engagement changes over time.

It's not to be so, I guess.

--

Got waaay carried away with exploring the APIs tonight - ended up spending about three hours on it! Oops. Day 16 of #100DaysOfCode. The outcome was learning about the APIs, playing with Guzzle to do http calls from php, eg for the LinkedIn API...:

        $url = 'https://www.linkedin.com/oauth/v2/accessToken';

        $client = new \GuzzleHttp\Client();
        $response = $client->request('POST', $url,
            [
                'query' => [
                    'grant_type' => 'authorization_code',
                    'code' => $_GET['code'],
                    'redirect_uri' => 'http://forrestedw.ngrok.io/auth/linkedin/callback',
                    'client_id' => env('LINKEDIN_CLIENT_ID'),
                    'client_secret' => env('LINKEDIN_CLIENT_SECRET')
                ]
            ]);

        $response = json_decode($response->getBody());

... and I integrated with the GutHub API to add my followers to my dashboard - all 1 of them!

Made by Ed in Somerset. 2019.