Google AdminDirectory API - Accessing license info and custom schemas - javascript

So I have a piece of Apps Script that works as expected - but there are 2 things I can't for the life of me figure out.
We have a custom schema, which is customSchemas.additionalAttributes.division - I can't figure out how to pull this from the AdminDirectory API.
Also - when performing a full user extract using Google Apps Manager (GAM), it pulls user license information - but again, it's not something that I can see when I look at the documentation for the API.
Does anyone know how to pull the custom schema info and the license data?
Link to documentation: Workspace Admin SDK > Directory API

You can pull the customSchemas of a user with the method Users:get
Set fields to customSchemas
Important: set projection to full
Keep in mind that this mehtod will only return you customeSchemas for a given user if a value for the particular schema has been assigned to the particular user
Sample response:
{
"customSchemas": {
"additionalAttributes": {
"division": "testdivison"
}
}
}

Related

Unable to fetch user data by using tiktok-scraper npm package

I have used tiktok-scraper for getting any public TikTok users data. It was working fine recently and I was able to get the required data but suddenly it stopped working and started giving this error:
Error: Can't extract user metadata from the HTML page. Make sure that the user does exist and try to use proxy
The module that I have used is .getUserProfileInfo('USERNAME', options) without using any options. Earlier I was able to get user details by just passing the username.
Someone has suggested to try using the cookie "sessionid_ss" in the sessionList option but I don't know where can I get this value from.
It would be great if someone can guide in this regard to get any public TikTok users' details based on the username.

How to list changes in a specific folder using Google Drive API Javascript

I am using the Changes:list API to list changes.
https://developers.google.com/drive/api/v3/reference/changes/list
But the results include all the folders in my drive. I want to filter the results for a specific folder. In the documentation, I don't see a parameter "q" for "changes:list" like the "Files:List" has.
Is there a way to filter the results via API parameter? or Do I need to do it in my code using the "folder Id" that I already know?
This is the code that I am using:
var request = gapi.client.drive.changes.list({
//The collection works by providing the current state of each item, if and only if the item has changed since a given point in time.
//point in history to retrive changes, we can saved this to know if there are changes
pageToken: '820167',
//test parameters that are not working
//q: "'12pDb31bRw7p3pfJoF_N6VncDqISSY1W4' in parents",
//q: 'trashed=false and "'+ folderId +'" in parents',
fields: '*',
pageSize: 5,
orderby:'title',
maxResults: 50
});
request.execute(function (resp) {
console.log(resp);
});
I might suggest instead using the Drive Activity API, which will let you query for changes within a folder. You'll want to specify the parameter ancestorName=items/${folderId}. Drive Activity will also give you a much more in-depth view of the actual activity that took place.
The Drive changes resource is pretty minimal. It is designed to provide a very quick view of changes across an entire drive / shared drive. The value it adds is the ability to setup a watch for push notifications - these could be used to trigger further action.
Unfortunately what you want cannot be achieved as the Changes: list method returns the list of changes for a user or shared drive.
Therefore, if you want to retrieve the changes for a specific folder, you will have to filter them afterwards programmatically in your code.
You can also submit a feature request on Google's Issue Tracker here and provide all the necessary details.
Reference
Drive API v3 Changes:list.

firebase v3 - google auth "internal-error"

I try to migrate my google-auth-only project from firebase 2.x to 3.0 using the web-sdk example from:
https://github.com/firebase/quickstart-js/blob/master/auth/google-redirect.html
After setting up the initialisation-code with apiKey (via Google-Developer-Console - used the server-option) and all the other needed options, i use the "login with google"-button.
After this, an redirect-screen appears, then redirecting back to starting page and getting an "auth/internal-error".
Any suggestions?
I would recommend importing your project in the Firebase Console rather than configuring keys manually if possible, but appreciate there are some cases where that isn't ideal.
For the API key, try switching to the "Browser" type key rather than the "Server" one for anything running in the browser, and make sure it is approved for the domain you are using.
Google Sign In will need a client ID as well. The easiest way to implement is to use the signInWithPopUp method, but there are instructions for manually configuring the Google Sign In lib too.
If you do need to create a client ID, you can see the full instructions in the Google Sign In documentation.

How to allow users to see my Google Analytics chart data without undergoing authentication/Sign In process

I am using the Google Analytics Javascript library to let users view a GeoMap of the particular page they are on. However, everytime they attempt to do so, thye have to go through an authentication process only to have my data displayed on my page. How can I find an alternative to this. I only want to embed my Analytics data through a visualized graph on my page so that all anonymous viewers can see it. This is the code where the process takes place.
google.setOnLoadCallback(init);
/**
* This is called once the Google Data JavaScript library has been loaded.
* It creates a new AnalyticsService object, adds a click handler to the
* authentication button and updates the button text depending on the status.
*/
function init()
{
myService = new google.gdata.analytics.AnalyticsService('charts_sample');
/*
this is essentially the line I want to replace. It anonymously
tries to access my viewer's account.I want to set this scope such as it
address the URI of my Analytics account
*/
scope = 'https://www.google.com/analytics/feeds';
/*
if the above scope is altered to my URI then the below unnecessary login
steps will not be required at all. This is the reason why my viewers are
taken to their analytics page which is fundamentally non-existent.
*/
$("authButton").onclick = function() {
// Test if the user is not authenticated.
if (!google.accounts.user.checkLogin(scope))
{
// Authenticate the user.
google.accounts.user.login(scope);
} else
{
// Log the user out.
google.accounts.user.logout();
getStatus();
}
}
getStatus();
}
// gets the account data and then gets the outputs of the requested query
function getStatus()
{
getAccountFeed();
getDataFeed();
}
function getAccountFeed()
{
//Here agsain, I want to modify it access my account's URI
var myFeedUri ='https://www.google.com/analytics/feeds/accounts/default?max-results=50';
myService.getAccountFeed(myFeedUri, handleAccountFeed, handleError);
}
function getDataFeed()
{
var myMapPopularityFeedUri = 'https://www.google.com/analytics/feeds/data?ids=ga%3A53482361&dimensions=ga%3ApagePath%2Cga%3Acity%2Cga%3Acountry%2Cga%3Aregion%2Cga%3Alongitude%2Cga%3Alatitude&metrics=ga%3Avisitors&start-date=2011-12-01&end-date=2011-12-25&max-results=50';
myService.getDataFeed(myMapPopularityFeedUri, handleDataFeed, handleError);
}
Help will be appreciated a lot. Please don't be too critical. Its my first question here. Instead let me know and I will make for my amendments.
Here is a screenshot of what the embed looks like upon my own click, i.e, after GA has
fetched my own data through my account. The geoMap is at the bottom of the page.
It seems the best way is creating of the separate shared (public) feed (report) in Analytics.
Just feed security requires authorization login to view or receive data if the feed (report) was created under personal credentials ... independently to what version OAuth or OAuth2 is used, just if you use request to view data on the site you should use at least API key (for public reports) OR OAuth credentials for personal reports.
look this guide:
Loading an API and Making a Request
or choose any other example from this page:
Google Analytics: Core Reporting API Client Libraries & Sample Code (v3)
Use this nice tool also:
OAuth 2.0 Playground
Generate API key for maps:
Google Maps API Family
Google Maps JS API tutorial:
Google Maps JavaScript API V3
Have you looked at using oAuth2 for the Authorization?

retrieve people/organization information from linked in

hi I am involved in a development of web app, where I have to retrieve information of people or organization from linkedin, dynamically.Suppose user A can search for Organization and user B can search for particular person.
I have gone the throough the linked in API's but was not able to figure it out how to implement it.
I am using Linkedin javascript API
Kindly help me
Using the LinkedIn API is a two-step process. First, get the user of your web app to authorize the app to access their LinkedIn information. This means setting up your app on LinkedIn as follows:
https://developer.linkedin.com/apis
Once you have that set-up, you can then query the LinkedIn API using JavaScript (I assume JavaScript is the language/method you want to use, as you tagged it).
You can adjust the results coming back, per the documentation, by using facets and parameters. For instance, to perform a people search that returns all user's named Barack and their profile headline and summary, you'd do something like:
IN.API.PeopleSearch()
.fields(["headline", "summary"])
.params({"first-name":"Barack"})
.result(function(result) {
alert JSON.stringify(result)
})
headline and summary are profile fields that you specify - you can change these to pull the information you need.
Update - including code to perform a company search.
To perform a Company Search using the JavaScript API, you'd use the IN.API.Raw() method:
IN.API.Raw("/company-search:(facets,companies:(id,name,universal-name,website-url))")
.result( function(result) { /* handle result */ } )
.error( function(error) { /* handle error */ } );

Categories

Resources