I have the id of the user and I need to get his login name. I use REST API: there is my code :

function ReturnItemBY(fieldName, listname, id, url) {
    //Url should be _spPageContextInfo.webAbsoluteUrl
    // var item = getListItems(url, listName, customquery, '', '');
    //ExecuteOrDelayUntilScriptLoaded(Start, "sp.js");
    var item = null;
        url: url + "/_api/web/lists/getbytitle('" + listname + "')/items(" + id + ")",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
            // Returning the results
            item = data.d;
        async: false
    return item.fieldName;


the problem is that he didnt know the name of the list which I put it "Users".

Dose any one know how can get it ,best regards.

  • 2
    You ask how to get users, yet your example code is about getting items. I'm not sure if I should show you how to get user in a field (with $expand) or how to get a user by id (from /Users). Sorry, but your question makes no sense to me
    – eirikb
    Nov 22 '14 at 19:15
  • For me as well.. Nov 22 '14 at 20:40

You may want to take a look at this link: Users, groups, and roles REST API reference. As noted by the comments from @eirikb and @Vadim, the url you are using will never give anything close to a list users.


I know this question was asked long ago but it might help someone in the future.

If you want to get all the users in your Sharepoint site you can use :


If you want to get the properties of the current user on the site then you can use :


I hope this helps.

  • 1
    This is good thanks. I was able to get the Id of someone with this code _api/web/siteUsers?$select=Id,LoginName,Title,Email&$filter=Title eq 'FirstName SecondName'
    – Nathan
    Feb 3 at 22:11
  • Thanks @Nathan, that really helped.
    – Shuvro
    Oct 8 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.