I want to filter the SP list using created date so that list items created in last 8 days get displayed.
I am using:
private getCarouselListContent = () => {
try {
let requestUrl = `${this.props.absoluteURL}/_api/web/Lists/GetByTitle('${this.props.listName}')/Items?$select=*$filter=Created eq '[Today]-8'`;
this.props.spHttpClient.get(requestUrl, SPHttpClient.configurations.v1)
.then((response: SPHttpClientResponse)=>{
if(response.ok){
response.json().then((responseJSON: any) => {
// Log the response to the console
console.log(responseJSON);
this.setState(({
value: responseJSON.value
}));
return responseJSON;
});
}
}).then((item: any) => {
if (item!=null){
try{
this.setState(({
value: item.value
}));
}
catch(err){
}
}
});
} catch (error) {
console.log('error in service ', error);
}
}
Can you help me with correct endpoint?