Skip to main content
Uploading images to the Wesog Search platform expands the tool’s search capabilities for a given organization by processing those images and adding them to the pool of images that can be retrieved via Wesog Search text queries. Ingestion can be performed either synchronously or asynchronously. However, since this process involves not only operations on our available hardware but also external requests to fetch the images, we recommend using the asynchronous mode, which will create an operation that can be queried afterwards.
Wesog Search does not extract metadata embedded in the image file itself (e.g. EXIF/IPTC data such as date taken, author, location, etc.). Any such information must be sent explicitly as part of the request body (title, date, author, location, keywords, etc.) so that it can be indexed and used for search and filtering.

Upload single image (POST /imgs/{item_id})

Parameters

This endpoint allows uploading a new image by explicitly indicating the unique identifier of the image in the URL. This identifier must be unique for each image and cannot be repeated with any other image already stored in the system. Additionally, like in the case of update and delete endpoints, the following parameters can be sent as Query Parameters: Finally, it is necessary to specify the image metadata, among which the most important is the src, which is the URL of the image to be uploaded. The rest of the metadata is optional, but it is recommended to send it to enrich the information associated with the image and improve its subsequent search. The following table shows all the fields that can be sent in the request body:

Request Example

A valid request example to this endpoint for uploading an image would be the following:

Responses

Image was uploaded successfully (Response Code: 201)

The different types of responses depend on whether the image upload process has been performed synchronously, if the task has been accepted but is pending asynchronous execution, or if some type of error has occurred during data validation: If the image has been uploaded successfully, all information related to the operation created to manage the image upload will be returned, for example:

Image upload accepted but pending (Response Code: 202)

If the request has simply been accepted but is pending asynchronous execution, an object with the ID of the operation created to manage the image upload will be returned, for example:

Error in data validation (Response Code: 422)

And if, on the other hand, some error has occurred during the data validation stage, this will be shown with an error message indicating the reason for the failure, for example:

Upload multiple images (POST /imgs)

The multiple image upload method or endpoint allows sending a collection of JSON objects in a single message, with each object representing a different image with its own metadata. The entire upload process execution is treated as a general operation that may or may not be executed synchronously or asynchronously, depending on the parameters sent in the request.

Parameters

Like other endpoints that result in the internal generation of an operation, the following parameters can be received as Query Parameters: On the other hand, in the request body a list of JSON objects must be sent, each representing an image to upload. Each object must contain at least the id field, which is the unique identifier of the image, and the src field, which is the URL of the image to be uploaded. The rest of the fields are optional, but it is recommended to send them to enrich the information associated with each image. The following table shows the fields that can be sent in each object of the list:

Request Example

Here is an example of how to use the Wesog Search API for uploading multiple images:

Responses

Images were uploaded successfully (Response Code: 201)

Similar to the scenario where only a single new image is requested to be sent to the Wesog service, in the case of sending multiple images, if they were processed and included within the system (or were processed and discarded due to some type of internal error), a response will be provided with a message including all relevant information related to the image upload process.

Images upload accepted but pending (Response Code: 202)

The process of uploading a set of images usually requires more time than uploading a single original image, depending on the amount of data sent to the service. For this reason, the type of response that will be shown predominantly in a short period of time after making the ingestion request will be this one. As seen previously when dealing with the process of uploading a single image, the operation ID, total number of images being processed, and a secondary message providing more information about the operation’s progress are sent, if necessary.

Error in validation data (Response Code: 422)

This error occurs just like in the case of the individual image, when the format of the sent message does not match the expected format, described in the request section. This happens mainly when necessary fields such as src or id are not included.