In my recent project I have been asked to populate the Manager field of a custom list automatically with out asking the user to input manager information. Then I started researching how to achieve this requirement with minimal code and with out writing a server side code
I just researched a bit about Microsoft SharePoint REST API, specifically related to user profile. Then I found the following nice link User profiles REST API reference. You can do a lot with REST API of user profile.
Since I wanted to get the current user manager and update the list item I have used the end point http://yourSharePointSite/_api/SP.UserProfiles.PeopleManager/GetMyProperties
This end point returns the whole information about the current user as shown below on the screenshot

User Profile GetMyProfile data
As shown above, there are a lof information we can get from the above end point like, account name, display name, email, job title, etc. I am not concerned about those informations at this moment. There are two places where the manager properties are displayed. One is <d:ExtendedReports m:type=”Collection(Edm.String)”> which is a collection of accounts. Those accounts my managers from top to bottom, which is from CEO to my immediate manager. The last element shows my manager. That is one way of getting my manager or there is <d:UserProfileProperties> which has a collection of objects out of which there is the following element
<d:element m:type=”SP.KeyValue”>
<d:Key>Manager</d:Key>
<d:Value>MyManagerAccount</d:Value>
< d:ValueType>Edm.String</d:ValueType>
</d:element>
The above element has my manager account information. I have used the following javascript to get the information.
$.ajax({
url: “http://testnrecanow.nreca.org/_api/SP.UserProfiles.PeopleManager/GetMyProperties”,
type: “GET”,
headers: { “ACCEPT”: “application/json;odata=verbose” },
success: function(data){
alert(data.d.ExtendedManagers.results); //You can get any information you want here and process it. I get the manager here and update my SharePoint list
},
error: function(){
alert(“Failed to get customer”);
}
});
Hope this helps a lot. Let me know if you have any question. I can be reached at tesfaye.gari@gmail.com or https://twitter.com/tesfayegari
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi.
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis.
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium.
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu.
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus.
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.