I have video site with nodejs as backend. Video is public for everyone so API is also public. This is the problem, they can view API and change params to get more data. I want to protect it from data leaking, spam or crawl.
I want to make each API is unique, each time user send a request, API will return data once. If he visit this API URL again, no data returned. If he refresh page, new API URL is being generated and give him data once. It look like this site https://www.douyin.com/video/7000302017407110436
Data return once only, if you visit below API call URL, it return null like this https://shorturl.at/cwI37
How do I do this?
If I got you right, you would like to send a link to a specific user and this link should only be called once. Here a basic concept:
FQDN/get/:id where "id" is the unique ID.One problem you might need to tackle: e.g. if you type in a certain url in a the browser, it makes a prefetch while you type it. Which means, that there are situations where a link then is called more then one time.