How to get or identify unique id or descriptor from Azure devops Profile REST API - api

I'm not getting the "descriptor" in Profile API response. This I need to save in database to identify whether he/she is a returning user on our web portal or a new user.
Did some research on Azure devops REST APIs to find that, there is something called "descriptor" which is a unique id for any user on Azure devops platform.
For that, I tried Profile REST API endpoint - https://app.vssps.visualstudio.com/_apis/profile/profiles/me?api-version=7.0
I need this descriptor or unique id because to identify whether a user is returning user or new user based on which I can create account or simply sign in. In other words, I'm implementing Oauth flow to Signup with Azure devops.
However, I get some "id" in Profile API response but that is not unique across different Azure devops accounts or organizations.
Any ideas on how to get "descriptor"? can we get in Profile API? or any other API?
Thanks in advance

Any ideas on how to get "descriptor"?
We cannot get the "descriptor" using the Profiles API.
To get the "descriptor" we can use Users - List - REST API (Azure DevOps Graph)
Alternately, we can use the following REST API for the currently logged in user:
https://dev.azure.com/{organization}/_apis/connectiondata

Related

How to find which Google Cloud Project is associated with an instance of Google Classroom?

I'm trying to pull our Google Classroom data into a custom web application via the Google API Client (PHP). I was able to make a successful call using a service account set up in Google Cloud, but the call returned no Classroom data.
I'm assuming the Classroom data must be associated with a different Google Cloud Project, I'm just not sure which one. I don't want to create a service account for every single project and test them, there are too many projects. I've looked everywhere and I can't seem to find the answer to the question: how do I find out WHICH project a Google Classroom integration is associated with, so I can configure the API Client accordingly?
I tried looking through all Classroom settings to see whether there was any information about the Google Cloud Project being used to store the data. I tried contacting Google Support, but so far I've had problems getting an answer to my question.
Ultimately I just want to pull the Classroom data into our web application.
Thanks
To use a service account with google classroom api you must configure Domain wide deligation. This will allow the service account to impersonate a user on your domain.
$user_to_impersonate = "admin#yourdomain.com";
$client->setSubject($user_to_impersonate);
The service account will then behalf as though they were that person. It can then see everything that user has access to.
Without delegation in place the service account doesn't have access to anything.

How to authorize google analytics API through API Key

I need to display the analytics of my site to all the users, but Using OAuth it displays the analytics of the sites configured for the logged in user. How can I implement a dashboard using embed API but showing my website analytics only?
The best possibility I can come up at is using API Key instead of Client ID, but I am unable to find a way to do it.
Does anyone have anything else in mind.
API keys are used for accessing public data, like the list of dimensions and metrics in the metadata API. In order to access private Google Analytics data you must use Oauth2.
So you don't want to use the API key, what you want to do is use a service account and then authorize the service account service-side, receive and access token from that authorization flow, and then pass that access token to the Embed API.
Here's a full working example:
https://ga-dev-tools.appspot.com/embed-api/server-side-authorization/

Another account access my Analytics API

I want to build a dashboard to my clients access your respective website analytics. But, after some research, I'm stuck.
Let's imagine the scenario:
My Analytics Account:
Client X - websitex.com
Client Y - websitey.com
In my dashboard, when the cliente Y log in, the data (pageviews) of websitey.com is shown on graphics.
But, there's a way to do that? By the moment, the only thing i got is retrieve information for my logged account (my analytics ID), not the information about another account.
There's a way to use the Google API, or, I'll have a "separate database" to save data each website?
Sorry, I'm really lost at the moment.
You can only view Google Analytics Accounts that you are authorized to view. For some reason this is a source of major confusion (seeing that your are not the first to ask), although it should be fairly self-evident.
If you want to see data from your clients account you have to ask your client to add your Google email to the GA account. If an email address is added to multiple accounts you can, via the API, choose between the accounts. Clientside authorization (OAuth2) will only work as long as somebody is logged in via a client application (usually a browser). The practial effect is that everybody who is authenticated via OAuth against Google will see only his own GA accounts, not other peoples data.
If you want a serverside application to pull data from various GA accounts you need a service account. But even the service account needs to be added to the GA accounts.
You can use the core reporting API, but the API will not give you access to accounts that you are not authorized to look at; your client needs to authorize you (or your applications service account).

How to get the NetSuite account meta-data from the NetSuite API?

I have an analytics app where people can plug their NetSuite account. Ideally, I would also retrieve some meta-data about the NetSuite account itself (ex: company name, etc) to make the analytics results more readable.
Does the NetSuite SuiteTalk SOAP API offers the possibility to retrieve meta-data about the NetSuite account itself?
Yes, you can get most of the company information using Configuration APIs
var companyinfo = nlapiLoadConfiguration('companyinformation');
var companyName = companyInfo.getFieldValue('companyname');
For a list of complete available fields please read "Preference Names and IDs"
EDIT:
Since, in SuiteTalk API, there is no specific API to fetch company information. I would recommend to write a RESTlet using above code and then access it via HTTPS in your Analytics application. If your application has to support multiple NetSuite account you may want to bundle your RESTlet.
In case someone needed to get the Company name, took me days to figure out so im sharing. You can use the token information endpoint defined here https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/chapter_157017286140.html
Calling a token endpoint to obtain user information based on a token
The tokeninfo endpoint returns information about a user based on the access token. The endpoint is https://{accountID}.restlets.api.netsuite.com/rest/tokeninfo, where is a variable for the company’s account ID. A response to a GET request contains data in JSON format, including information such as: Company Name, Company ID (account ID), Role Name, Role ID, Entity ID
NetSuite provides a Roles service that contains some very limited metadata about the account (Name and ID). See the Help Document titled "Using the REST roles Service to Get User Accounts, Roles, and Domains".

Google Analytics - Service Account and Segments

I've created an app for Google Analytics in the API console. I am trying to list out custom segments that have been created, but have noticed that I cannot view existing Segments that have been created.
I followed this example: Service Applications and Google Analytics API V3: Server-to-server OAuth2 authentication?
For instance, I log in to my google analytics account, grant access to a profile, then in the google analytics profile, I create a sample segment.
Calling this:
$service->management_segments->listManagementSegments();
I would expect to see my "test segment" but don't see it.
Is there an additional step that I would need to grant my service account the ability to see the custom segments setup?
This example here shows the custom segments:
https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/segments/list
I am hoping someone can clarify the workflow. Thanks!
Since segments are tied to google accounts, not service accounts, they aren't available. It's best to grab segment definitions using the web server workflow, or use dynamic filters instead of segments.