REST,
Do PUTthis to indicate a new structure that generates a hash, that is, not based on the number passed. Just a "random" hash. Then each subsequent record would include id-hash with a returned hash of the result of the sent numbers. Then, when you get the idea that you can cache the results.
1. PUT /api/average/{number} //return id-hash
2. POST /api/average/{id-hash}/{number} // return average-hash
3. GET /api/average/{average-hash}
4. DELETE /api/average/{id-hash}
You can then cache the average hash, even if you can get the result differently, or different servers get the same average.
source
share