You use the $expand query option. For
For example, a list has a lookup field,you have two lists: LookupFieldListA
, and in that list areListB
. ListA
has two fields you want to pull with the query,: Field1
and Field2
. ListB
has three fields: FieldA
, FieldB
and LookupField
. LookupField
looks up to ListA
. REST query should be as such:
/_api/web/lists/GetByTitle(guid'<guid>''ListB')/items?$select=Title$select=FieldA,FieldB,LookupField/Field1,LookupField/Field2&$expand=LookupField
You select the fields from the list by adding their internal name to the $select
query option, and you select fields from the lookup list by using the format LookupField/FieldFromLookupList
, and then you add the lookup field to the $expand
query option.