Skip to content

Workflow

Sequence Diagram
sequenceDiagram
    autonumber

    participant BE as Your<br>Backend
    participant API as Aiuta<br>API

    alt
        BE->>API: Upload an image (bytes)
        API-->>BE: Return AiutaImage (id, url)
    else
        BE->>API: Get predefined models
        API-->>BE: Return categories list<br>of AiutaImage (id, url)
    end

    BE->>API: Generate operation (uploaded_image_id, sku_id)
    API-->>BE: Return Response (operation_id)

    loop
        BE->>API: Get operation (operation_id)
        API-->>BE: Return Operation object
        BE->>BE: Check status<br>operation field

        critical status
            option SUCCESS
                Note right of BE: generated_images field<br>with url in resulting object
            option FAILED
                rect
                    Note right of BE: error field<br>contains error message
                end
        end
    end

1. Upload an image or use predefined model

Upload an image which you want to use as in input for generation. It may be some model whom you want to dress in specific clothes item. You will receive an object with image id and url as a result. Use image id on the next step to specify the uploaded_image_id for generation.

Use the list of predefined models API endpoint to retrieve the available models. Each predefined model’s image has an id, which is used in the next step to specify the uploaded_image_id for generation.

2. Create a generation operation request

Provide uploaded_image_id received on the previous step as well as SKU identifiers: sku_id and optional sku_catalog_name ("main" by default). You will receive an object with operation_id of created image generation operation in case of successful request or an error message otherwise.

3. Get the operation results

Use an operation_id from the previous step to retrieve the operation status. Operation became completed once operation status turns to SUCCESS or FAILED. In case of successfully completed operation you will receive generated_images with url in resulting object. If an error occurred you can check error message in the error field.