Structure of an Operation
An operation is described by the fields shown in the following table:
These attributes aren’t provided directly when creating an operation, since there isn’t an endpoint specifically for that. Instead, whenever you call the endpoints for image upload or processing, the Wesog Search system automatically creates these tasks behind the scenes to ensure that a heavy request doesn’t block the entire system, but is interleaved with other clients’ API requests.
As operations are primarily used to monitor the progress of tasks, their associated endpoints are designed to:
- Retrieve all tasks for a given tenant
- Fetch detailed information about a specific task
- Cancel a scheduled task
Operations Endpoints
Check Operation Status (GET /ops/{op_id})
Given a GET /ops/{op_id} request with the header API-Key: <api-key>, you can retrieve the status of a specific operation for a particular tenant.
Request Example
Response
The response will be a JSON object containing the operation details, including the fields described in the table without theop_id field, which is the one you queried. The errors field will contain any errors that occurred during the operation, if applicable.
Receive operation status (Response code: 200)
Here you can see an example of response JSON object:See all operations (GET /ops)
This endpoint is the simplest, since you only need to send the access API key to the Wesog server; using that, the system can identify the tenant making the request and return all operations they’ve performed.
When requesting all operations, no additional parameters beyond the API key in the request header are required, and the server responds with a JSON-formatted list of Operation objects, containing the various parameters shown in the table at the beginning of this section.
Request Example
Abort current running operation (DELETE /ops/{op_id})
Once a task is started, even if it was indicated to run asynchronously, it may be necessary to abort it. To do this, a DELETE /ops/{op_id} call can be made, sending the header API-Key: <api-key>, and the Wesog server will cancel the operation if it has not yet finished.