MsGraph get users filter to get only person account - azure-active-directory

Is there a way to list users and filter only real person account using MsGraph users API ?https://graph.microsoft.com/v1.0/users
Currently, it returns person but also conference rooms and others.
I see that you can retrieve persons you work with using people API:
https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}/people?$filter=personType/class eq 'Person' and personType/subclass eq 'OrganizationUser'
Is there anything similar for users ?
Thanks you !

The current options are to either use the People API like you said or the List orgContacts endpoint from the Microsoft Graph Rest API Beta.
GET https://graph.microsoft.com/beta/contacts
This returns the list of organizational contacts for the organization.

Related

Exception in Site.createExternalUser in Apex RESTclass: Site.ExternalUserCreateException: [That operation is only allowed from within an active site.]

I have a Non-Salesforce Auth System which holds usernames and passwords for a few thousand users. I am willing to migrate these users to Salesforce and give access to these users to my Experience Cloud site. I am developing an apex REST Resource which will take username and password as arguments and create a user with that username and password with a community profile. I am planning to call this API from my Non-Salesforce system and migrate all these users. I am using Site.createExternalUser method in this API. I am getting the exception
Site.ExternalUserCreateException: [That operation is only allowed from within an active site.]
The reason I am using Site.createExternalUser is because I don't want to send the welcome email/reset password email to my users since they already have signed up successfully long ago.
I am open to any alternatives for achiving this.
Below is my code:
#RestResource(urlMapping='/createUser/*')
global with sharing class createUserRestResource {
#HttpPost
global static String doPost(){
Contact con=new Contact();
con.Firstname="First";
con.LastName= "Last";
con.Email="first.last#example.com";
con.AccountId='/Add an account Id here./';
insert con;
usr.Username= "usernameFromRequest#example.com";
usr.Alias= "alias123";
usr.Email= "first.last#example.com";
usr.FirstName= "First";
usr.IsActive= true;
usr.LastName= "Last";
usr.ProfileId='/Community User Profile Id/';
usr.EmailEncodingKey= 'ISO-8859-1';
usr.TimeZoneSidKey= 'America/Los_Angeles';
usr.LocaleSidKey= 'en_US';
usr.LanguageLocaleKey= 'en_US';
usr.ContactId = con.Id;
String userId = Site.createExternalUser(usr, con.AccountId, 'Password#1234', false);
return userId;
}
}
You can suppress sending emails out in whole org (Setup -> Deliverability) or in the Community config there will be way to not send welcome emails (your community -> Workspaces -> Administration -> Emails).
Without running on actual Site I don't think you can pull it off in one go. In theory it's simple, insert contact, then insert user. In practice depends which fields you set on the user. If it's Partner community you might be setting UserRoleId too and that's forbidden. See MIXED DML error. In Customer community you might be safe... until you decide to assign them some permission sets too.
You might need 2 separate endpoints, 1 to create contact, 1 to make user out of it. Or save the contact and then offload user creation to #future/Queueable/something else like that.

How to get the Overall Categories, Sub Categories in Amazon MWS?

Hi I'm started the web development in Amazon MWS. I need to integrate the get category list, add product, list product etc in my application. I have referred the documentation, http://docs.developer.amazonservices.com/en_IN/products/Products_Overview.html But, in that document there is no option to get all the categories, sub categories in mws. And also i have referred several sites, they told me to refer the Browse Tree Report in MWS Api. But, there is no section in the report section. Is Amazon MWS have something like "Get Categories" method, or is there any way to do this ?
For simple to use and explore checkout
https://www.browsenodes.com
It also has option to browse the categories for other countries.
Example for India the URL is
https://www.browsenodes.com/amazon.in
You can get the categories for a market place api by requesting Browse tree report. Each browse node( Amazon way of storing categories ) contains a field child_nodes which gives you information about the sub categories.
http://docs.developer.amazonservices.com/en_IN/reports/Reports_ReportType.html#ReportTypeCategories__BrowseTreeReports
If you are looking for the categories of individual product. Please refer
http://docs.developer.amazonservices.com/en_IN/products/Products_GetProductCategoriesForSKU.html
http://docs.developer.amazonservices.com/en_IN/products/Products_GetProductCategoriesForASIN.html
The Browse Tree Guide is an Excel file available for download from the Amazon Seller Central. Once logged in, go to Seller Central Help > Manage Inventory > Reference > Browse Tree Guide
I tried in amazon mws scratchpad and could get category information. (scratchpad website: https://mws.amazonservices.com.au/scratchpad/index.html) .
The process of getting categories:
API section Reports -> RequestReport (report type:_GET_MERCHANT_LISTINGS_DATA_, report option: _GET_XML_BROWSE_TREE_DATA_)
GetReportList(in this list, you may find ReportId related with '_GET_XML_BROWSE_TREE_DATA_' )
GetReport(use this ReportId as input).
Then you can get the tree report for all categories
Amazon does not make it easy to get all the categories, but I think what you are looking for is actually in AWS Browse Nodes.
http://docs.aws.amazon.com/AWSECommerceService/latest/DG/BrowseNodes.html
Maybe it's a little late but i wanted to answer the question so some other ones
find useful. First, you need to make a request to RequestReport action, after that, you will make a request to GetRequest action using previous action's id, this will give you a long list of the categories (for the marketplaces you specified in the query). This is the link to the action & service, and also don't forget to take a look at ReportTypes enums, you must define them correctli.
POST /Reports/2009-01-01 HTTP/1.1
Content-Type: x-www-form-urlencoded
Host: mws.amazonservices.com
User-Agent: <Your User Agent Header>
AWSAccessKeyId=0PB842EXAMPLE7N4ZTR2
&Action=RequestReport
&EndDate=2008-06-26T18%3A12%3A21
&MWSAuthToken=amzn.mws.4ea38b7b-f563-7709-4bae-87aeaEXAMPLE
&Marketplace=ATVPDKIKX0DER
&ReportType=_GET_MERCHANT_LISTINGS_DATA_
&SellerId=A1XEXAMPLE5E6
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&StartDate=2009-01-03T18%3A12%3A21
&Timestamp=2009-02-04T18%3A12%3A21.687Z
&Version=2009-01-01
&Signature=ZQLpf8vEXAMPLE0iC265pf18n0%3D
► Option 1 :
Go To : https://sellercentral.amazon.com/gp/help/help.html/ref=au_1661_cont_help?ie=UTF8&itemID=1661&language=en_US
Log with your Amazon account ( even if you don't have seller user ).
Press on link : "Inventory File Templates and BTG" ( wait few seconds and it will download the file )
Print screen for Option 1
► Option 2 :
if you are looking for a CSV File that contains Amazon departments, categories, sub categories and their links ( based on : https://www.amazon.com/gp/site-directory ) , you may check also in this github repository : https://github.com/postme205/AmzCategoriesSubCategories/ or Here (github.io)

How to validate if the Google Plus profile exists?

I have combined Admin SDK Directory API with the Google+ Domains API to fetch all the Google plus profile information.
But , There are people who do not have Google Plus profile in our organization which generates a null pointer Exception,I also tried the below code to validate
Person profile = plus.people().get(directorylist.getId()).execute();
if(!profile.isEmpty())
{
System.out.println(profile.getDisplayName());
profile.getImage().getUrl();
profile.getSkills();
System.out.println("SKILL="+profile.getSkills());
System.out.println("ORG="+profile.getOrganizations());
}
But the validation is not working and it is throwing null pointer Exception . Let me know if anyone has a better solution to this problem
You want:
public abstract boolean isPlusUser()
source

Using the API to get google directory contacts

I am a Google Apps customer and want to use the Contact API to search for a user in the company directory.
I am able to access contacts using for example:
feed = gd_client.GetContacts()
However the contacts this returns is only a subset of my contacts and is not those in the company directory.
Has anyone had experience of this or give me any pointers.
I think what you are looking for is the Domain Shared Contact API instead of the Contact API. Check this out (https://developers.google.com/google-apps/domain-shared-contacts/)
Try to run the get request against the domain, you should be able to retrieve your directory contacts instead of personal contacts (https://developers.google.com/admin-sdk/domain-shared-contacts/#Retrieving)
Try using Query to get result feed. You can specify max results to get in query. This way your result feed will be returned with more contacts in other groups as well.
URL FeedURL = new URL("https://www.google.com/m8/feeds/contacts/default/full");
Query MyQuery = new Query(FeedURL);
MyQuery.setMaxResults(200);
ContactFeed ResultFeed = MyService.query(MyQuery, ContactFeed.class);

Save Extra Contact Data in Data Store

we are making a social network using GAE, and when we are going to create user's, we need to save contact's data about facebook, twitter, etc...
This extra contact data must be administrable by an administrator, so if the administrator adds "Whatsapp", to all users must appear a field "Whatsapp" optional, and if the administrator deletes the facebook data, all users' facebook info must be deleted.
What is the best option to save this data, considering the most efficient way, for example, for get the all user's facebook, for delete all user's twitter... by an administrator?
Thanks
There are many ways to solve this problem. One would be to have a config model, such as (assuming python) ...
class Config(db.Model):
""" singleton model """
twitter = db.BooleanProperty(default=False)
facebook = db.BooleanProperty(default=False)
whatsapp = db.BooleanProperty(default=False)
And separate fields on your profile model for each social username ...
class Profile(db.Model):
name = db.StringProperty() # users name
twitter = db.StringProperty() # store twitter username here
facebook = db.StringProperty() # store facebook username here
whatsapp = db.StringProperty() # store whatsapp username here
When you render the profile to the client, check the Config class to see what social fields have been enabled, and only render those fields.
To handle the deletion, you may need to write a cron job to iterate through all profiles and delete whatever data has been disabled on the config model.
Hope this helps
You should certainly store all entities that contain a User's specific data in the User's entity group. That enables you to retrieve and manipulate those entities using ancestor queries, which perform better than non-ancestor queries.
To make the detail entities part of a User's entity group, you simply have to create them with the parent parameter. For instance:
class TwitterData(db.Model):
twitter_name = db.StringProperty
def addTwitterData(user, twitter_name):
# User is an instance of users.User
new_twitter_entity = TwitterData(parent=user)
new_twitter_entity.twitter_name = twitter_name
new_twitter_entity.put()
Now, I can get User's data like this:
twitter_accounts = TwitterData.all().ancestor(user).fetch(1000)
Also, you can use a kindless ancestor query to get all of the entities in user's entity group:
all_networks = db.Query()
all_networks.ancestor(user).fetch(1000)
# Now, ancestor has all of user's Twitter, Facebook, Myspace accounts.
One of the strengths of this approach is that it allows your users to have more than one account on any of the various services.
If the data that you need to store for the different social sites varies too much to be served by a single, simple model, you can use Expando classes to store entities that store different types of data.

Resources