You are updating the memory model using the REST api. This means that you maintain state on the server between requests.
A REST-complete way to access this should be for the client to maintain state by simply processing the request and returning all the information to build the next request in the response. The server then restores the memory model from the information in the request, and then does its job. Thus, if you are working, for example, in a clustered environment, any of the available servers will be able to process the request.
Regardless of whether or not this is the most efficient way to do this, depends on your application. There are many enterprise applications that use a server-side session and develop load balancing to ensure that clients always use the same nodes in the cluster. Thus, the presence of state on the server side is a completely correct design choice, and there are many ways to implement it. However, server-side state usually complicates scaling, and REST in the purest sense is to avoid server-side state and complexity.
A workaround / trade-off is storing state in some database or storage. Thus, your nodes can retrieve state from disk before processing the request.
It all depends on what you need and what is acceptable for you. As the previous commentator has already noted, do not depend too much on this whole thing. It is clear that someone will have to maintain the state, and the question is simply what is best to put this state for you and how you turn to it. Basically, there are a couple of trade-offs that are mostly related to various โwhatโ scenarios. For example, if the server crashes, do you want your client to re-run the entire set of requests to restore the calculation, or do you prefer to simply resend the last request? I can imagine that you really do not need high availability here, and do not mind the low risk that something is not suitable for your customers from time to time. In this case, having server-side state in memory is an acceptable solution.
Assuming your server contains the computation state in some hash map, the REST-ful way to pass the state around then can simply send back the key for the model in response. This is a completely REST-ful API, and you can change the implementation to maintain state or do something else without changing the API when necessary. And the main thing is to be REST-ful: to separate implementation details from the API. Your client does not need to know where you are placing the state or how to store it. All he needs is a representation of the resources of this state that can be manipulated.
Of course, the key must be represented as a URI. I recommend you read Jim Webber's "REST in Practice." This is a great introduction to REST-ful API design.