8

I want to retrieve the OOTB Modified By value using REST API. I tried the below options in my REST Query:

Editor/Title&$expand=Modified By
Editor/Title&$expand=Editor

I am getting the error : The expression "Modified By" is not valid.

Please suggest how to achieve this?

To check the "Modified By" field name , I have queried all fields using below request:

https://servername/_api/web/lists/getbytitle('MyLibrary')/Fields?$select=Title,InternalName

Here's the response for "Modified By":

<d:InternalName>Editor</d:InternalName><d:Title>Modified By</d:Title>

Please help me here!

Thanks!

1
  • Hi, do you want to get the value of modified by field for the item? Commented May 4, 2017 at 16:06

2 Answers 2

8

You need to use expand with the this Editor field.

In the $expand, you should specify the person field you want to expand.

$select=Editor/Title&$expand=Editor

Try below query:

https://servername/_api/web/lists/getbytitle('MyLibrary')/fields?$select=Title,InternalName,Editor/Title&$expand=Editor
2
  • I tried the below query: https://servername/_api/web/lists/getbytitle('Pages')/items?$Select=Created,ID,Title,Modified,Status,CurrentAuthor/Title&$expand=CurrentAuthor,Editor/Title&$expand=Editor I have two people columns - one is CurrentAuthor and other is Editor(ModifiedBy). This query works for CurrentAuthor but does not work for Editor. It throws error "The query to field 'Editor' is not valid. The $select query string must specify the target fields and the $expand query string must contains Editor." Commented May 5, 2017 at 6:09
  • 1
    You cant use multiple $expand. The query should be as below: https://servername/_api/web/lists/getbytitle('Pages')/items?‌​$Select=Created,ID,T‌​itle,Modified,Editor/Title,Status‌​,CurrentAuthor/Title‌​&$expand=CurrentAuth‌​or,Editor Commented May 5, 2017 at 6:54
7

You can use below syntax

$select=Editor/Title&$expand=Editor/Id

You query will turn into

https://servername/_api/web/lists/getbytitle('MyLibrary')/Items?$select=Title,InternalName,Editor/Title&$expand=Editor/Id
4
  • Thank You for the response, now am getting this error "The query to field 'Editor' is not valid. The $select query string must specify the target fields and the $expand query string must contains Editor." Commented May 4, 2017 at 14:13
  • The end point for getbytitle("mylibrary")/Fields don`t provide ModifiedBy information. Commented May 4, 2017 at 15:37
  • Is this not achievable? To fetch OOTB ModifiedBy field using REST API? Please guide me if I am missing something here. ThanQ! Commented May 5, 2017 at 6:11
  • Are you looking for field modified by or item modified by column? In the question you are referring "<d:InternalName>Editor</d:InternalName><d:Title>Modified By</d:Title>" is a peroperty of a list item not a field property. Check this query for field property siteurl/_api/web/Lists/getByTitle('listtitle')/Fields?$filter=InternalName eq 'Title' Commented May 5, 2017 at 15:13

Your Answer

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

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