Does Linkedin API provide a way to get the Recent Updates from our company's profile - linkedin

I am working on building our external web site for the company, and I want to show our company's LinkedIn profile's Recent Updates inside our web site. Currently when I access our company LinkedIn profile I can see those recent updates, which are available to public users as well (so users do not have to login to Linkedin to view those Recent Updates), as follows:
I read about the LinkedIn JavaScript API, and the capabilities it provides, and I already created a new LinkedIn Application and I set the required setting as mentioned on this link https://developer.linkedin.com/docs/getting-started-js-sdk but I got confused on how I need to use it and how the authentication will be managed.
I have the following questions:
Can anyone link me to some sample Code about using LinkedIn JavaScript SDK to get our company Recent Updates?
How the authentication for the LinkedIn JavaScript SDK work? I mean does the SDK allow getting our LinkedIn company profile's Recent Updates without require the user to be login to LinkedIn in advance? again our company Recent Updates can be viewed by any user who access our LinkedIn profile page (user does not have to be login to linked to view our profile and our Recent Updates). And since we are planning to show the Recent Updates inside our external web site, so we can not assume that any user who will view our web site is already login to LinkedIn to view those LinkedIn Recent Updates, or that the user has a LinkedIn account in the first place.
Edit
Based on the reply from #Craig Wayne. Now in my case I did not set any thing regarding the OAuth, since I only configure the required steps for the JavaScript as follow, so is this fine?:
Now I tried to use this link https://codepen.io/craigiswayne/pen/KGbqRq to test the Api call, where I entered the following info:-
Client ID: - "I entered out client id 14 digit"
REST URL:- "companies/<<our 8 digits id>>/updates?start=20&count=10&format=json"
but it keep trying to load the results, as follows:
Now final step inside our Sharepoint page I added the following code:
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: 14 digits code
onLoad: LinkedINJSAPI.onLoad
authorize: true
credentials_cookie: true
credentials_cookie_crc: true
</script>
<script>
var LinkedINJSAPI = {
onLoad: function(){
IN.User.authorize(LinkedINJSAPI.request, this );
},
request: function(){
var url = 'companies/<<>8 digits code>>/updates?start=20&count=10&format=json';
IN.API.Raw(url).
method('GET').
result(function(result){
console.log( JSON.stringify( result ) );
}).
error(function(error){
console.error( error.message );
});
}
}
</script>
where I got a popup from linked to enter a username and password,and after login, I got this error inside the browser console:
Member does not have permission to get company.

LinkedIn has an extensive API.
Does LinkedIn API provide a capability to get the company's Recent Updates?
Yes. LinkedIn API's provide the last 50 updates, including Job Postings, New Products, and Status Updates. Consult the API reference for company updates.
Can we securely integrate with the API using client side code (JavaScript)?
Yes. LinkedIn provides a JavaScript SDK. You should start by consulting their Getting Started with the JavaScript SDK guide, then look at their Company Pages guide.
Are API capabilities offered for free?
I can't find any documentation for pricing. It appears to be free with a rate limit throttle.
Can anyone link me to some tutorials & docs about integrating with LinkedIn apis using javascript code? and how we need to register with these APIs?
If you sign in to their developer site, you can create an application that will grant you the ability to make API calls.
Getting Started with the REST API guide
Get a company's updates
Create an Application to use the API's in their Developer site (requires free login)
Is there an RSS feed that can achieve these same goals?
There is an existing answer that outlines using RSS for displaying company updates.

Add your LinkedIN JS SDK to your site, should look something like this:
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: <!-- YOUR CLIENT ID (API KEY) HERE -->
onLoad: LinkedINJSAPI.onLoad
authorize: true
credentials_cookie: true
credentials_cookie_crc: true
</script>
After which in your JavaScript add in the following:
var LinkedINJSAPI = {
onLoad: function(){
IN.User.authorize(LinkedINJSAPI.request, this );
},
request: function(){
var url = 'companies/1337/updates?start=20&count=10&format=json';
IN.API.Raw(url).
method('GET').
result(function(result){
console.log( JSON.stringify( result ) );
}).
error(function(error){
console.error( error.message );
});
}
}
You can see a working demo here...
https://codepen.io/craigiswayne/pen/KGbqRq

Member does not have permission to get company
can you confirm that the person that you login as has administrator permissions on the company page ?
if you login with the account on linkedin , do you see a manage option for the business page when you press on the "me" option next to the notifications.
because someone that wants to get company data has to be an administrator of the linkedin company page.

Related

LinkedIn javascript SDK Share Dialog

How can I force LinkedIn to always show the share dialog, I am using LinkedIn JavaScript API. My current implementation is like this
IN.User.authorize(function(){
IN.API.Raw("/people/~/shares?format=json")
.method("POST")
.body(JSON.stringify(payload))
.result(function(response){
deferred.resolve(response);
})
.error(function(error){
deferred.reject(error);
});
});
If user is logged in and already has authorized the app, text is shared on LinkedIn without showing the share dialog.
I want user to have a look at the content before actually posting in on LinkedIn.
If you don't use the SDK for sharing plugin, then you can just use a raw URL and it should work fine:
https://www.linkedin.com/sharing/share-offsite/?url={url}
Source: Microsoft LinkedIn Share URL Documentation.
For example, this will bring up the prompt for me:
https://www.linkedin.com/sharing/share-offsite/?url=http://www.wikipedia.org/
Prompt works fine:

Accessing Google analytics api using api key

I'm trying to implement Google analytics API using API key to make it available without authorization. But i can get examples using CLIENT ID in google developer console itself. Can anyone help me with an example using api key?
It is not possible to access Google Analytics API with the API key. You must use Open Authentication.
If you are trying to access your own data you can use a service account. Create new credentials choose Service Account.
You can then take the service account email address:
1046123799103-nk421gjc2v8mlr2qnmmqaak04ntb1dbp#developer.gserviceaccount.com
Add it as a user at the ACCOUNT level it is very important that it be at the ACCOUNT level it wont work other wise. Your application with then be able to access your Google Analytics data with out a log in.
Without knowing what language you are working with I cant give you any examples.
Update:
If as you say you are planning on doing this with JavaScript then you will have to go with Oauth2 and request access. There is no way to use a Service account with JavaScript.
There for I strongly recommend that you find a server sided programing language to do this in. Even if it did work with JavaScript you would end up running out of quota on the API before to long.
Google Analytics' EmbedAPI will allow you to display your Google Analytics via javascript, and users will be able to log in on page.
You will still need to get your clientAPI, but then users will be able to login independently.
The javascript code is described in the dev guide and a sample is below:
<script>
gapi.analytics.ready(function() {
// Step 3: Authorize the user.
var CLIENT_ID = 'Insert your client ID here';
gapi.analytics.auth.authorize({
container: 'auth-button',
clientid: CLIENT_ID,
});
</script>
The API limit should be no problem, its 50,000 calls per day.

Using Google Analytics to show subset of data for customers of web application using embed api

I'm developing an application where each 'business' has its own page (or rather many pages):
For example example.com/business/abc/
So, for the logged in business owners in the system I would like to give a feature 'View page analytics'. It would display how many visits (and maybe a couple of other things) that particular page has had.
Is there a way of doing this using the Google Analytics API with my constraints:
I don't want customers to provide their own UA code
I don't want them to require to have GA account
Customers don't need to have Google email account
I don't want to build the entire frontend and backend myself. I would rather use something existing
I've been researching this topic for hours trying to come up with a solution and can't figure out anything.
Here is what I tried and what problems happened to me:
http://ga-dev-tools.appspot.com/demos/embed-api/
This is basically exactly what I want for my customers to be displayed on my site (like in the examples), except that Embed Api tries to authorize users to their own (owned) google analytics. I want it instead to use my own Google Analytics data (or rather part of it)
The way I thought about limiting data access would be for every one of my customers to create a View in GA, Add filter to that View so only customer pages are listed there, assign User to the view, and use the Embed Api to display data from that View only. There are a couple of problems with that:
To assign User to View we need email address. And this must be either google account email, or account from a project created with Google Developers Console (application).
In other words I can't create (in any way that I know) an account that would be a shield account for my customers to a subset of my GA data that they would be interested in. It must be either a real user or a real application email address.
So what I tried to do is... I created an app in Google Developers Console, Created new OAuth Service Account. Using Ruby code (that in production app would be running on backend) I obtained OAuth token. I added this email of my OAuth service account as a User to the View
I wanted this server side generated oauth token to be used by Embed Api. That would achieve the effect that I generate the token for on my backend and user can use it without having GA user in my GA property. So I changed according to documentation the basic Embed Api example to use
gapi.analytics.auth.authorize({
container: 'auth',
clientid: 'xxx.apps.googleusercontent.com',
serverAuth: {
access_token: 'Server side generated token'
}
});
instead of
gapi.analytics.auth.authorize({
container: 'auth',
clientid: 'xxx.apps.googleusercontent.com',
});
The effects are not quite what I expected. The example doesn't show anymore (I can't see my data) but I can see in Netowrking section in Chrome that it is actually receiving real data from GA. But for unknown reason, nothing is appearing.
What I try to avoid is building a solution in which I need to build server side code that is querying GA for data, providing it to the frontend and then JS is responsible for displaying it. I would rather use Embed API but it seems not to be well suited for the use case where I don't want users to play with their UA data but rather with my own UA data limited to some scope. I would like to have at least the frontend or backend part of the solution solved. The solution doesn't need to be even Google Analytics based. Anything else that would let me achieve the use case easily and let the business owners see the effects of their marketing (traffic, sales) would be interesting as well.
Related:
Using google analytics API to show subset of data for customers of web application
Google analytics customer data?
Google Analytics API: filter by URI?
https://embeddedanalytics.com seems like something that could be useful, but their page and graphs look like from a few years ago. I would like something more pretty.
https://oocharts.com seems to be interesting because of what their docs.oocharts.com says about queries. But they don't charge anything for their product so I am skeptical of their business model and whether it is a good long-term solution. update: dead link
I don't have enough karma to post links ;)
TLDR: Displaying subset of my GA data to my customers without forcing them to become GA users and adding them to my GA account.
Any help appreciated!
Without seeing your code it's hard to know where the problem is, but using the serverAuth option definitely works. And when using the serverAuth option, you don't need to specify a client ID or container, all you need to enter is the following:
gapi.analytics.auth.authorize({
serverAuth: {
access_token: 'Server side generated token'
}
});
Here's an example that will work if you enter in a valid access token and the idsfor a view to which you have access:
http://jsbin.com/vukezoheyeco/3/edit
Note: when doing auth like this, it happens sync. This can be a gotcha if you're used to an async auth flow (like normal) and you add an event handler listening for the "success" event after calling .authorize because then your handler will never run.
I think you need the Google Analytics Super Proxy
You download the github package and upload to your own App Engine project, do some minimal configuration and then you have an interface where you can setup Google Analytics API calls which require no user login.
It provides end user URLs that you can use to construct data tables in your front end, it also provides data-table format so it slots right into Google Charts.
So for example, you have a user that needs access to visits, revenue for site section /sectionA/
You set up the GA super proxy to serve them a URL that only includes data for that section - you can try out queries here in the GA query explorer. In this case, metrics=ga:visits,ga:productRevenue and filter~=ga:page=/sectionA/
This produces an end URL with JSON data, that refreshes daily/hourly - your choice. You import this URL into your app.
The end user then logs in to your app, and sees the chart data generated from the end URL for their login. They don't need to know about GA super proxy, they just see the end resulting chart.
You could get more sophisticated by providing dropdowns to select which data chart they see, which changes the GA super proxy URL that is requested.

Google Analytics API: "User does not have sufficient permissions for this account."

I'm writing a Ruby app that accesses the Google Analytics API to pull down some experiment information.
The app connects and authenticates using a Google Service Account via the following function:
def connect
...
##client = Google::APIClient.new(:application_name => 'My Service App',
:application_version => '1.0.0')
key_file = Rails.root.join('config', 'privatekey.p12').to_s
key_secret = 'somesecret'
key = Google::APIClient::PKCS12.load_key(key_file, key_secret)
asserter = Google::APIClient::JWTAsserter.new(
SECRETS[:google_service_account_email],
['https://www.googleapis.com/auth/yt-analytics.readonly',
'https://www.googleapis.com/auth/analytics.readonly'
],
key
)
##client.authorization = asserter.authorize()
...
end
...which authenticates and discovers both APIs without issue.
Using the client against the YouTube Analytics API works without issue. Using the same exact account to access the Analytics API via...
response = ##client.execute({
# 'analytics is the API object retrieved via discover_api()
:api_method => analytics.management.experiments.list,
:parameters => {
'accountId' => 'AAAAAAAA',
'profileId' => 'PPPPPPPP',
'webPropertyId' => 'UA-WWWWWWWW-#'
}
})
Results in a 403 error response:
{"domain":"global","reason":"insufficientPermissions","message":"User does not have sufficient permissions for this account."}
In regards to authorization, I have double-checked the account service#myapp.com:
Has full permissions to the Google Analytics web interface. I logged in using the service#myapp.com account and was able to view the same Experiments I attempted to list.
Has enabled the Analytics API. Within the API Console, I confirmed in the Services section that the Analytics API item is switch to ON. (Just like YouTube Analytics is.)
I am using the appropriate AccountID, ProfileID, and WebPropertyID values. Copied directly from the Google Analytics web interface.
Given that the service account can access at least one API (YouTube Analytics), and the associated account (service#myapp.com) can access the Analytics web interface, there seems to be something wrong with the service account accessing the Analytics API in particular.
Any ideas?
Similar topics:
“Not sufficient permissions” google analytics API service account (NOTE: This error is slightly different than mine)
Analytics blog post, check comments section for 'permissions'
Make sure you give the service account email (something like 1234567890#developer.gserviceaccount.com) permissions to read/write from your GA view.
Admin > View > User Management > "Add permissions for:"
Pick the right id!
In my case I was using the right credentials (account id, account secret -> authorization_code -> access_token) AND had the email permissions set up right but I was using the account id on the Admin > Account settings page and simply adding ga: to the front.
The id you actually need is the table id! (or that's the one that worked for me at least since most people here are mentioning the account id, which didn't work for me.). You can find that one here: https://ga-dev-tools.appspot.com/account-explorer/
And then you can query as
service.get_ga_data(TABLE_ID,'2017-03-25','2017-03-25','ga:users,ga:pageviews')
I found this API to be badly documented overall and the UI was unclear. But maybe that's just me.
If you still see this message after you added your developer email to analytic user.
You may need to add scope to the object, before new Google_Service_Analytics($client);
$client->setScopes("https://www.googleapis.com/auth/plus.login");
I spent whole day trying to solve this!
I also had to go to the developer console and enable the API in order to make it work. Go to the developer console and select your project and enable the API(s) you want to use.
Make sure your are entering the correct table_id
(ie. GetProfiles(oauth_token)
tableid_input = "ga:72848696")
Even after adding the email to the account level in analytics I still had the same permission problem but the following suggestion helped but didn't solve it:
$client->setScopes("https://www.googleapis.com/auth/plus.login");
That didn't work for me but this did:
$client->setScopes("https://www.googleapis.com/auth/analytics");
https:// is now required to authenticate.
If you are new just to let you know 3 Step procedure required
Enable Google Analytics Reporting API then create service email account (OAuth Client ID)
Add and give permission this service email in google console
Add and give permission this service email account in Google analytics tracking -> User management
Make sure you give the service account email (something like 1234567890#developer.gserviceaccount.com) permissions to read/write from your GA view.
Admin > View > User Management > "Add permissions for:"
I got this issue when I try to integrate GA source to metabase.
Metabase requires Oauth clientid and secret. So I create Oauth clientid in GA (If you face an issue which said you need a Guite user to make it internal access, then you need register a new account under workspace).
Then, I solve this issue by adding my google cloud(workspace) account to view user management, not
1234567890#developer.gserviceaccount.com
Just the google cloud login account, I tried with 1234567890#developer.gserviceaccount.com but it doesn't work. The difference for metabase is it ask the oauth id and secret for your google cloud account not service account.
Hope this can help someone face the same situation.
But it is still trick because another GA4 service which don't have any view
How to create view in Google Analytics 4
Still can't solve this issue.
If any one knows it, please comment. Just don't know how to call the api in GA4 since there isn't view at all.
For me, it has been solved when I select the property that was created with enabling "Create a Universal Analytics property" in "Show Advanced Options" section
Other answers are outdated for Google Analytics v4.
There's a different api that one need to enable and use.
https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart-client-libraries
For node.js:
import { BetaAnalyticsDataClient } from "#google-analytics/data";
import { google } from "googleapis";
const auth = new google.auth.GoogleAuth({
credentials: {
client_email: process.env.GOOGLE_CLIENT_EMAIL,
client_id: process.env.GOOGLE_CLIENT_ID,
private_key: process.env.GOOGLE_PRIVATE_KEY,
},
});
const analyticsDataClient = new BetaAnalyticsDataClient({
auth,
});
If someone has more view he should use the view ID.

Google Calendar API view / edit rooms / resources?

Is there some way with the Google Calendar API to view which rooms have been booked when retrieving a meeting via the API?
Also is there a way to add a room resource to a meeting via the Calendar API?
The fact that you are using resources with Google calendar tells me that you are a Google Apps for Business/Education user.
If you want a list of resources at your organisation you need to use the Google Apps Calendar Resource API. You can also use this API to create new resources.
If you want to list availability of a calendar resource you need to use the Google Calendar API. You need to query the API using a username that has the appropriate permissions to view the resource calendar. The id of a calendar resource looks like an email address ending in #resource.calendar.google.com
You will also notice that resources are listed amongst your event attendees.
Now the bad news
At the time of writing (October 2013) the Google Apps Calendar Resource API uses Atom/OAuth 1.0a whereas the Google Calendar API version 3 uses JSON/OAuth 2.0.
So that means you currently need to implement two different mechanisms of authentication and two different styles of API, fun eh?
That said since Google are deprecating support for OAuth 1.0a, I'm sure they are beavering away re-writing the Google Apps Calendar Resource API to become JSON/OAuth 2.0 compatible (I may post a question here to ask about that!).
Update
Please see my question for information regarding the lifespan of the Google Apps Calendar Resource API:
Google Apps Calendar Resource API v1 (Atom/OAuth 1.0) likely lifespan?
I've just tried it out - it works fine (returns array of booked dates for each resource id, eventually if such array is empty - resource is available for you. I'd like to get boolean values, but still..)
So, you need to use following API.
Go to section try it
login using oauth
paste request below (Replace resource ids to existing)
Request code:
{
"maxResults": 10,
"timeMin": "2013-11-27T00:00:00+02:00",
"timeMax": "2013-12-27T23:59:59+02:00",
"items": [
{
"id": "RESOURCE_ID_1#resource.calendar.google.com"
},
{
"id": "RESOURCE_ID_2#resource.calendar.google.com"
},
{
"id": "RESOURCE_ID_3#resource.calendar.google.com"
}
]
}
Have you tried querying the free/busy information of the resource (https://developers.google.com/google-apps/calendar/v3/reference/freebusy/query)?
You can update a room resource to a meeting by updating the event
(https://developers.google.com/google-apps/calendar/v3/reference/events/update).
Hopefully, this gives you some good ideas.

Resources