First thing that comes to mind is some kind of function that does lock a request to your API? For instance if one would POST to /user you can register this in a table stating that POST-user for API key 123456 is currently being executed. At the beginning of the method that creates the User you can check your database if a record is found for the API key and action they try to do. If a record is found: don't execute yet.
Feb 21, 2016
5
Level 2
Preventing duplicate requests on the server side.
I've built a simple API. When a user posts a request, a model is created, and a bunch of related models are attached to it, some are detached from the user. The problem though is that I can always game the server using curl.
I'm looking for a couple of options to prevent duplicate requests on the server side. I've yet to find any reasonable solution.
Any help is appreciated.
Cheers, Mattew
Please or to participate in this conversation.