Put Api Image

Hello,

Is it possible to upload an image to a product via API {PUT} with cs-cart?

Thanks,

Yes, it is possible. Try to add to the array with product data

['main_pair'] => array(
    ['detailed'] => array(
        ['http_image_path'] => IMAGE_URL,
        ['image_path'] => IMAGE_URL
    )
)

perfect, thanks

Hello, i try but it not works.

can you share another method ?

Thank you

try this:

{PUT} https://mysite.com/api/products/147471
{
        "image_pairs": {
        "1": {
            "detailed": {
                "image_path": "https://host_site_where_the_image_is/10084.jpg"
            }
        },
        "2": {
            "detailed": {
                "image_path": "https://host_site_where_the_image_is/10346.jpg"
            }
        }
    },
    "main_pair": {
        "detailed": {
            "image_path": "https://host_site_where_the_image_is/10003.jpg"
        }
    }
}
1 Like

Hello,
I try to put images with API i try all codes with this code too :

[‘main_pair’] => array(
[‘detailed’] => array(
[‘http_image_path’] => IMAGE_URL,
[‘image_path’] => IMAGE_URL
)
)

Please help me with code to put images via API, which code is working on cs-cart ?

thank you

Hello,

Please try

{
    "product": "Test product API #2",
    "product_code": "ASK_65_ARB",
    "price": 125.55,
    "category_ids": [ 7491 ],
    "main_category": 7491,
    "amount": 1000,
    "main_pair": {
        "detailed": { "image_path": "https://example.com/image-0.jpg" }
    },
    "image_pairs" : [
        {
            "position": 1,
            "detailed": { "image_path": "https://example.com/image-1.png" }
        },
        {
            "position": 2,
            "detailed": { "image_path": "https://example.com/image-2.png" }
        },
        {
            "position": 3,
            "detailed": { "image_path": "https://example.com/image-3.png" }
        }                
    ]
}

For more details please check complete API documentation.

I hope the above is useful to you.

3 Likes