That API Guy's - API Forum

I can't find 'ts' in document

<img :src="'http://thecatapi.com/api/images/get?type=gif&size=med&ts=' + timestamp" />
I find the code above ,but I don’t know what the ts mean in the url? And I can’t find anything ralated in the doument, can sb help me ? Thanks a lot
https://jsfiddle.net/chudaol/4hnbt0pd/2/

Hi @niusz, it looks like whoever wrote the code is adding a timestamp value as a ‘cachebuster’

The ‘ts’ query parameter has no effect on the API, but as the timestamp continually changes it makes the whole url itself unique, this means the browser/client won’t load the data for the url from it’s cache, and will make a fresh request to the API every time. In this case giving you a new random .gif.

Some people use a random number instead to achieve the same result e.g. ‘…&cachebuster=’ + Math.random()

This technique shouldn’t be needed anymore, as the API responds with headers telling the client not to cache the response, however some clients may not support them.