POST
Pujar una imatge de producte
Scope:
inventory:products.writehttps://api.holded.com/api/v2/products/{productId}/imagesUploads 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
productId
stringobligatoriID 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/jsonobject
idstringrequired
Respostes d'error
400Sol·licitud incorrectaapplication/json401API key no vàlida o no proporcionadaapplication/json403Permisos insuficientsapplication/json404Producte no trobatapplication/json422Entitat no processableapplication/json429Límit de sol·licituds exceditapplication/json