Sharepoint - Retrieve userprofiles by REST API

May be you are missing encodeURIComponent()

URL should look like

/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='"+encodeURIComponent('i:0#.f|membership|[email protected]')+"'

PS: After applying encodeURIComponent() I got it working.

If you are using any REST client, then convert i:0#.f|membership|[email protected] into encodeURIComponent at first.

Paste encodeURIComponent('i:0#.f|membership|[email protected]') in any browser's console. It will output something like "i%3A0%23.f%7Cmembership%7Cfirstname.aftername%40domain.se". Finally using following end-point to get user profile properties

/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='i%3A0%23.f%7Cmembership%7Cfirstname.aftername%40domain.se'

Update#1

  • It should be console.log(data.d); not console.log(data.d.results);

Try following modified code

$.ajax({
  url: siteUrl+ "/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='"+encodeURIComponent('i:0#.f|membership|[email protected]')+"'",
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: function(data, status){
    console.log(data.d);

 },
  error: function(err){
    console.log(err);
  }
});