I am having trouble to create an expand query using the REST API.
I have two lists which are linked.
PIR
Title, Date, Number
SIR
Title, PIR2SIR (lookup to Title in PIR), Date, Number
Now I want to display all listitems from PIR with their related SIR's
$.ajax({
url: url + "/_api/web/lists/getbytitle('" + listname + "')/items?$select=Title,Date, Number,Title/PIR2SIR&$expand=Title",
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
timeout: 2000,
dataType:"json",
success: function (data) {
complete(data); // Returns JSON collection of the results
},
error: function (xhr,status,error) {
console.log(status);
}
});
My code returns an error. How should I use the linked list in this query?