Saltar al contingut principal
POST

Pujar una imatge de producte

Scope:inventory:products.write
https://api.holded.com/api/v2/products/{productId}/images

Uploads an image and associates it with the specified product. Send the file as `multipart/form-data` using the `file` field. Allowed image types: jpeg, png, gif. Maximum 200 images per product.

Paràmetres

Paràmetres de ruta

productIdstringobligatori

ID del producte (ObjectId hexadecimal de 24 caràcters)

Cos de la petició

object
filestring<binary>required

Image file (jpeg, png, gif)

Petició

python
import requests

url = "https://api.holded.com/api/v2/products/{productId}/images"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
}

files = {"file": open("file.pdf", "rb")}
response = requests.post(url, headers=headers, files=files)
print(response.json())

Respostes

Resposta

json
{
  "id": "507f1f77bcf86cd799439011"
}

Respostes exitoses

201Imatge pujada correctamentapplication/json
object
idstringrequired

Respostes d'error

400Sol·licitud incorrectaapplication/json
401API key no vàlida o no proporcionadaapplication/json
403Permisos insuficientsapplication/json
404Producte no trobatapplication/json
422Entitat no processableapplication/json
429Límit de sol·licituds exceditapplication/json