Forum Discussion

Chirag Shah's avatar
Chirag Shah
Copper Contributor
Aug 30, 2018
Solved

Rest API - Fetch Data using POST method and CamlQuery and Lookup Column

Hello,   I am trying to get Username(Display name) from YourName field which is Person type field. But When I get result, I get ID as YourNameId. How can I get name rather than Id with using follow...
  • Chirag Shah's avatar
    Chirag Shah
    Sep 07, 2018

    I got the solution. I used the POST method to fetch data from the list

    My actual query is around 384 characters long.

    I think this post can be helpful to anyone who is seeking a solution using the POST method and without the character limit.
    When using $expand all the lookup columns must expand using FieldValuesAsText/ColumnName.

    https://contoso.sharpeoint.com/_api/web/lists/GetByTitle('JourneyDetails')/GetItems?$select=*,FieldValuesAsText/YourName,FieldValuesAsText/Author&$expand=FieldValuesAsText&$filter=SupervisorApprovalStatus eq 'Approved' and TravelDepartmentApprovalStatus ne 'Approved' and TravelDepartmentApprovalStatus ne 'Rejected'

Resources