senthilbp
senthilbp

Reputation: 807

How to Post LinkedIn Company status update using API?

Is there anyway to update company status of linked in company pages via API call using PHP,

Upvotes: 2

Views: 7270

Answers (4)

Andy
Andy

Reputation: 5091

The accepted answer for this question is no longer valid and another answer linking to the announcement that it is now available has two broken links

To clarify, you can now post company status updates/shares and the documentation for this is located at https://developer.linkedin.com/docs/company-pages#company_share

Upvotes: 2

Johnny Oshika
Johnny Oshika

Reputation: 57502

As of August 2013, LinkedIn's API supports sharing to company pages.

Announcement.

Official documentation.

Upvotes: 1

Vlado
Vlado

Reputation: 3777

This is a very quick guide. Take a look at my decision using the LinkedIn API. Have in mind that before doing that:

  1. you must have a personal profile in LinkedIn;
  2. your company must have a company page in LinkedIn (http://www.linkedin.com/company/yourcompanyname);
  3. you must be an administrator of your company page (in order to publish updates on behalf of your company).

When the above conditions are met go to https://www.linkedin.com/secure/developer and sign in with your personal profile credentials. Add a new application in order to get API Key, Secret Key, OAuth User Token and OAuth User Secret.

PHP code for LinkedIn API on your side to post company shares:

require 'OAuth.php'; // .. or install the PECL extension.. Google it

$apiKey = 'xxxxxxx'; // take it from your application
$apiSecret = 'yyyyyyyyy'; // take it from your application
$accessToken = 'zzzzzzzzz'; // take it from your application
$accessToken = 'kkkkkkkkkkk'; // take it from your application
$oauth = new OAuth($apiKey, $apiSecret);
$oauth->setToken($accessToken, $accessTokenSecret);

$body = new stdClass();
$body->comment = 'Some comment';
$body->content = new stdClass();
$body->content->title = 'Some title';
$body->content->description = 'Some description';
$body->content->{'submitted-url'} = 'http://www.mycompany.com/article_id/123456'; // ID of your company page in LinkedIn
$body->visibility = new stdClass();
$body->visibility->code = 'anyone';
$body_json = json_encode($body);

$oauth->fetch('http://api.linkedin.com/v1/companies/12345678/shares', $body_json, OAUTH_HTTP_METHOD_POST, array(
  "Content-Type" => "application/json",
  "x-li-format" => "json"
));
$response = json_decode($oauth->getLastResponse());

I hope it helps.

Upvotes: 2

Unpossible
Unpossible

Reputation: 10697

There is no way to create what LinkedIn refers to as a 'share' for a company at this point. Here is a post on their forums relating to this.

Upvotes: 3

Related Questions