I'm accessing the QuotesOnDesign randomized endpoint: https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&
and for some reason I'm getting the same value returned everytime, even with no-cache enabled. This happens in every browser and in Postman.
No, idea what I can do to fix this, as it was working literally just a few weeks ago. My last commit was the end of June and it was working fine then.
My function that accesses the endpoint is as follows:
httpCallout(){
fetch('https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&', {cache: "no-cache"})
.then(response => response.json())
.then((data) => {
const quote = data[0].content;
console.log(quote);
this.setState({
quote: quote,
author: data[0].title
});
});
}
In theory, it should return a new quote every time, as it previously was. But now, I'm simply receiving the same data every time.
It appears that website uses client-side code to pick some kind of a starter value (perhaps a random seed, or an ID, or a page number, or something?) to start with and includes that ID in the request (e.g. https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&_=1564694860977).
Since you're not including that value in your request, it's apparently using a default value, and since it's the same value every time you're getting the same results every time.