I plan on using an HTTP REST interface to connect to a Job Control service.
One key operation is to request a computational Job.
- The caller does not know the ID of the Job; that is what it will be told.
- The job will be marked in the database as locked by the service.
- The data needed for processing of the job will be returned to the caller.
Later on, when the caller is done processing the job, it will send the results back via another REST call.
- Now it knows the ID of the record to be updated.
- The second REST call will update the Job record with the results.
- and change the Job's status and release the lock.
- Only the Success/Fail status needs to be returned.
I am leaning towards using PUT for each operation because no new record is being created; it is being updated in both cases.
Is this proper? Can the first PUT return a large JSON payload with the Job data or does it just return an HTTP status? Should I use a POST instead, even though I am not creating a record, just updating it?
I would have used a GET for the first operation, but a GET is not supposed to change any objects on the service, and I am locking it, which is a change. Is locking a record acceptable in a GET request?