4

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!

4

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
  • 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." – user2598808 May 5 '17 at 6:09
  • 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 – Gautam Sheth May 5 '17 at 6:54
3

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
  • 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." – user2598808 May 4 '17 at 14:13
  • The end point for getbytitle("mylibrary")/Fields don`t provide ModifiedBy information. – Venkat Konjeti May 4 '17 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! – user2598808 May 5 '17 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' – Venkat Konjeti May 5 '17 at 15:13

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.