0

I'm using the following URL to get data from a list. The last item in the URL is the Author/Id but it returns a number.

How can I get the user's name instead of the number?

url: https://.../org/eu/EU3/EU34/_api/web/lists/GetByTitle('EU34SupportTracker')/items?$select=Title,Attachments,AttachmentFiles,Worklog&$expand=AttachmentFiles&$expand=Author&$select=Author/Id 
1
  • 1
    You can write multiple fields in single $expand and $select. No need to write it multiple times. try my answer given below and let me know if it works for you. Oct 27, 2020 at 8:13

2 Answers 2

0

Use this:

$select=Author/Name,Author/Title&$expand=Author

Test result: enter image description here

2
  • Thanks Amos. I used Author/Title and I got the name I was trying to get.
    – martinbshp
    Oct 27, 2020 at 8:53
  • You are welcome.
    – Amos
    Oct 27, 2020 at 8:53
0

This behavior is correct. In order to get the name of user you need to use below REST API URL:

https://.../org/eu/EU3/EU34/_api/web/lists/GetByTitle('EU34SupportTracker')/items?$select=Title,AttachmentFiles,Worklog,Author/FirstName,Author/LastName&$expand=AttachmentFiles,Author

Or If you have set the display name to user fields then you can also use:

Author/Title

instead of Author/FirstName and Author/LastName

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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