How can I retrieve a unique identifier for a user in AutoCAD Online? - autodesk-forge

I am building an application that needs to generate links to a user's AutoCAD Online files. To do this, I need to retrieve a unique identifier associated with the user in AutoCAD Online, which is generated when the user connects with SSO Google. I get a link like this
https://web.autocad.com/googledrive/00613****/
I have tried using the
https://developer.api.autodesk.com/userprofile/v1/users/#me
endpoint to retrieve the unique identifier for the currently authenticated user, but the identifier returned by this endpoint (HQ7HRK***) does not match the format of the identifier I am looking for (00613012******).
I have also checked the endpoints available in Google's People API, but I have not been able to find any information about the AutoCAD Online unique identifier.
Is there another API endpoint I can use to retrieve the unique identifier for a user in AutoCAD Online? Or is there another way to construct a URL to a user's files that does not rely on this identifier?
Any guidance or advice would be greatly appreciated. Thank you!

Related

Get drive files stats (views/openings) | Google Drive API

I've been searching the docs but I can't find anything.
The goal is to retrieve different stats from our files. Actually, we can retrieve almost everything we need, except for the document openings and document openings per user.
So here is the question: How can I retrieve document views of a drive document (a G Sheet to be more precise) ? Can I segment it by user ?
Thank you
I understand that your goals are the following one:
You want to retrieve document views
Of a particular document (and you know it's id)
Associated to a specific user
Please correct me if I get it wrong. If those are your goals, then you can use the Admin SDK as pointed out by Rubén in the comments. Now I am going to detail how you can make such a request easily.
You could use the method activities.list() to get a list with what you want. You only have to populate these four parameters:
Parameter
Value
Description
userKey
The user's email
Determine the user
applicationName
drive
Identifies the Google service
eventName
view
Designate the type of activity
filters
doc_id=={MY DOCUMENT ID HERE}
Filters by the document
That configuration will provide you with your desired data. Leave a comment below if you need help creating that request in your own environment.

Get User's first and last name via Google API

Currently I am developing a Chrome-GMAIL extension which requires me to get the logged in user's first and last names. For experimentation, I have used the following goggle API (userinfo) and have successfully obtained the names I wanted:
https://www.googleapis.com/auth/userinfo.profile
However, using the userinfo APIs will cause a change in the OAuth2 scopes in my manifest. This change will in turn cause a permission-prompt to my existing users (if a domain wide delegation is not setup in place). Point being the idea of having more prompts in front of my user, or additional oauth scope is not really something I desire.
Currently our extensions use the following OAuth scopes and API :
Chrome's Identity API
Chrome's Storage API
GMAIL.modify
GMAIL.send
My question is, is it possible to get the first and last names using an API that is defined/allowed/provided for by any of the above scopes/permissions I listed? or is userinfo the only way to go?
Thank you very much.
Profile data like first name and last name is private data. You are corect that some Google apis give you access to some data that would normally require an extra scope. For email normally you would need to to request the email scope to get this back however the Gmail api does have an endpoint getprofile which will return the current users email address without you requesting the email scope.
However i am not aware of any apis that will give you access to the users first and last name without you requesting the profile or user.profile scope.
If you do decide to add the scope, I do recommend going though the people api rather then the userinfo endpoint as the data returned by the user info endpoint is not guaranteed to always return the name.

Salesforce Development and configuration

I want to merge 6 different profiles into one, consolidating FLS, Record Type, Permission sets, Page layouts in salesforce. May I know whats the best possible and easiest way to do it?
Thanks
Use the Salesforce Metadata API to retrieve the 6 profiles in xml form. You can then view all the permissions each profile has and consolidate into one. Then use the Metadata API deploy() to deploy the profile to your Salesforce org.
Salesforce give examples on how to retrieve profiles and the required package.xml to include in the request here: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_profile.htm
Note: the retrieval content of profiles is relative. i.e to see the profile permissions for Account object, you must include the Account object in your retrieve request.
Salesforce documentation:
https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/file_based.htm
https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_retrieve.htm

value attribute for Permissions Resource not populated in responses

Looking at:
https://developers.google.com/drive/v2/reference/permissions#resource
the values attribute which contains the email address value for the ACL is not returned by the API. It's not clear why the value isn't returned, I assume it's a privacy issue but it means Drive SDK can't support document migration (from one Google account to another) use cases where the old Documents List API v3 can:
https://developers.google.com/google-apps/documents-list/#retrieving_the_acl_for_a_document_file_or_collection
for now I'm looking at adding both Drive API and Docs v3 API scopes for my project and just using the Docs API call to retrieve the ACLs but ideally I'd be able to use just Drive API calls. Am I missing anything? Could a special scope be added to Drive API that allows ACL email address retrieval or is there some other way to handle this?
Jay
Thanks for your question Jay and thanks your answer Ali Afshar!
Unfortunately I do not understand how Google believes the following scenario should work without the email address of the users:
In Documents List API v3 you could copy a file A to file B, retrieve the ACL-information of file A (including the users email adresses) and simply add them as ACL to file B.
With Drive API you can retrieve almost the same Permission information, but without the user email address, which is still required to re-share file B to the same users.
As a sidenote: If you use GAS DefaultService DocsList, you can still receive the editor/viewers with getEditors() or getViewers(). If you manually share a file you can see all email addresses as well.
So if you ask me, the privacy issue is a valuable argument, but it does simply not apply here.
Jan
Since this question was posted, Drive API has been updated to allow permissionId to be sent on permissions.insert() (the id attribute). This allows for migration of ACLs without ever needing to know the email addresses (just straight copy the permissionIds over to the new file).
Additionally:
the permissions.getIdForEmail() API call provides a quick way to get the ID for a given email address
when returning permissions for a file with permissions.get() or permissions.insert(), the domain attribute is included which should help determine if the ACL raises security concerns.
I believe these features cover most use cases where the actual ACL email address retrieval was needed.
You are absolutely correct, the email address is hidden for privacy. It is not right that a user should see the email addresses of all other users that have access to the file. But I'm not sure I quite get the problem. Are you migrating using service accounts, or are users individually authorizing the migration?
The value in the permissions feed is consistent for each user, and that value is available in the about feed for a user. I assume you know the email address of the users, so you can authorize for each of them With a service account, and you can migrate the data.
You should not need the Drive API scope and the Docs v3 API scope, they are pretty much the same scope.
Also resurrecting this old thread, I had the same issue while migrating documents.
A workaround:
- Create a temporary folder
- Insert a permission for the user
- retrieve the id from the permission
Not nice, but works for me.

How to get the owner of file using Google Drive API

I am thinking of developing an application like this:
My application has a google-service-account
I let my users share their documents with my service account
While an user visits my application, he gets some reports based on the files he has shared.
For this, my application needs to uniquely identify the owner of the documents shared with it. I looked at the API but could not find how to do so. I found methods like File.getOwnerNames(), but they are plain strings containing the names, but not any unique key to identify the user.
Need help on how to achieve this. Thanks.
Sanjay
Use the permissions.list method and find the permission corresponding to the owner.