I am implementing a REST webservice and I have a resource (http://localhost/createUser) which is a POST method and takes in a JSON user object.
Now at time t1, a caller calls this API with a JSON object. I make basic validations at time t1 and return response as sucessfull.
But at my backend, this person creation logic takes a while to "really create" and persist it to database - which will take some time - say at time t2 - the user creation is completed.
Now what are the ways for me to notify the caller that this User Creation has been "really successfull"? (or the user creation might fail in between t1 and t2, how to notify this to the caller of this API? what are the ways?)
One way I think of is, create a requestId for each such request and the caller keeps polling another GET API, like (http://localhost/status/requestId) which will give him the result for that request.
Is there any better way to do this?