diff --git a/docs/source/plugins/example/plugin.py b/docs/source/plugins/example/plugin.py index 2c29c39c..e99f9e85 100644 --- a/docs/source/plugins/example/plugin.py +++ b/docs/source/plugins/example/plugin.py @@ -142,4 +142,4 @@ class TimelapseAPI(MicroscopeViewPlugin): self.timelapse_task = taskify(self.plugin.timelapse)(n_images) # Return the state of the task (will show ID, start time, and status before the task has finished) - return jsonify(self.timelapse_task.state), 202 + return jsonify(self.timelapse_task.state), 201 diff --git a/docs/source/plugins/hardware.rst b/docs/source/plugins/hardware.rst index 3b4aa956..cd2f0a70 100644 --- a/docs/source/plugins/hardware.rst +++ b/docs/source/plugins/hardware.rst @@ -44,7 +44,7 @@ An example of a long running task may look like: def post(self): # Attach the long-running method as a microscope task self.my_task = taskify(self.plugin.long_running_function)() - return jsonify(self.my_task.state), 202 + return jsonify(self.my_task.state), 201 After some time, once the task has completed, it could be retreived using: @@ -132,7 +132,7 @@ For example, a timelapse plugin may look like: self.timelapse_task = taskify(self.plugin.timelapse)(n_images) # Return the state of the task (will show ID, start time, and status before the task has finished) - return jsonify(self.timelapse_task.state), 202 + return jsonify(self.timelapse_task.state), 201 Notice that even though we never use the stage here, we still acquire the lock. This means that during the timelapse, diff --git a/openflexure_microscope/plugins/default/autofocus/api.py b/openflexure_microscope/plugins/default/autofocus/api.py index 172391c8..0e7ed816 100644 --- a/openflexure_microscope/plugins/default/autofocus/api.py +++ b/openflexure_microscope/plugins/default/autofocus/api.py @@ -29,7 +29,7 @@ class AutofocusAPI(MicroscopeViewPlugin): task = taskify(self.plugin.autofocus)(dz) # return a handle on the autofocus task - return jsonify(task.state), 202 + return jsonify(task.state), 201 else: abort(503, "No stage connected. Unable to autofocus.") @@ -50,7 +50,7 @@ class FastAutofocusAPI(MicroscopeViewPlugin): task = taskify(self.plugin.fast_autofocus)(dz, backlash=backlash) # return a handle on the autofocus task - return jsonify(task.state), 202 + return jsonify(task.state), 201 else: abort(503, "No stage connected. Unable to autofocus.") diff --git a/openflexure_microscope/plugins/default/camera_calibration/plugin.py b/openflexure_microscope/plugins/default/camera_calibration/plugin.py index 6708cbba..126bb86c 100644 --- a/openflexure_microscope/plugins/default/camera_calibration/plugin.py +++ b/openflexure_microscope/plugins/default/camera_calibration/plugin.py @@ -18,7 +18,7 @@ class RecalibrateAPIView(MicroscopeViewPlugin): task = taskify(self.plugin.recalibrate)() # Return a handle on the autofocus task - return jsonify(task.state), 202 + return jsonify(task.state), 201 class Plugin(MicroscopePlugin): diff --git a/openflexure_microscope/plugins/default/scan/api.py b/openflexure_microscope/plugins/default/scan/api.py index d61ab01d..13a9a8f2 100644 --- a/openflexure_microscope/plugins/default/scan/api.py +++ b/openflexure_microscope/plugins/default/scan/api.py @@ -60,4 +60,4 @@ class TileScanAPI(MicroscopeViewPlugin): ) # return a handle on the scan task - return jsonify(task.state), 202 + return jsonify(task.state), 201 diff --git a/openflexure_microscope/plugins/example/api.py b/openflexure_microscope/plugins/example/api.py index 1417359a..ac818184 100644 --- a/openflexure_microscope/plugins/example/api.py +++ b/openflexure_microscope/plugins/example/api.py @@ -73,7 +73,7 @@ class LongRunningAPI(MicroscopeViewPlugin): # Attach the long-running method as a microscope task try: task = self.microscope.task.start(self.plugin.long_running, time_to_run) - return jsonify(task.state), 202 + return jsonify(task.state), 201 except TaskDeniedException: return abort(409) @@ -94,7 +94,7 @@ class SomeExceptionAPI(MicroscopeViewPlugin): # Attach the long-running method as a microscope task try: task = self.microscope.task.start(self.plugin.some_exception) - return jsonify(task.state), 202 + return jsonify(task.state), 201 except TaskDeniedException: return abort(409) diff --git a/openflexure_microscope/plugins/testing/form_example/api.py b/openflexure_microscope/plugins/testing/form_example/api.py index f41ad4f5..d4fc40f6 100644 --- a/openflexure_microscope/plugins/testing/form_example/api.py +++ b/openflexure_microscope/plugins/testing/form_example/api.py @@ -57,4 +57,4 @@ class TaskAPI(MicroscopeViewPlugin): task = taskify(self.plugin.generate_random_numbers_for_a_while)(val_int) # return a handle on the autofocus task - return jsonify(task.state), 202 + return jsonify(task.state), 201