Mettre à jour un produit
curl --request PATCH \
--url https://qwoty.app/api/products/{id} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"description_inherit_from_product": true,
"primary_image_inherit_from_product": true,
"reference": "<string>",
"is_active": true,
"category_ids": [
{}
],
"inventory": {
"sku": "<string>"
},
"settings": {
"unit_per_pack": 123
},
"accounting": {
"ledger_account": "<string>"
},
"identifiers": {
"crm": "<string>",
"erp": "<string>",
"accounting": "<string>"
},
"shipping": {
"weight": 123,
"weight_unit": "<string>",
"height": 123,
"length": 123,
"width": 123,
"length_unit": "<string>",
"country_of_origin": "<string>",
"harmonized_system_code": "<string>"
},
"primary_image_id": "<string>"
}
'import requests
url = "https://qwoty.app/api/products/{id}"
payload = {
"name": "<string>",
"description": "<string>",
"description_inherit_from_product": True,
"primary_image_inherit_from_product": True,
"reference": "<string>",
"is_active": True,
"category_ids": [{}],
"inventory": { "sku": "<string>" },
"settings": { "unit_per_pack": 123 },
"accounting": { "ledger_account": "<string>" },
"identifiers": {
"crm": "<string>",
"erp": "<string>",
"accounting": "<string>"
},
"shipping": {
"weight": 123,
"weight_unit": "<string>",
"height": 123,
"length": 123,
"width": 123,
"length_unit": "<string>",
"country_of_origin": "<string>",
"harmonized_system_code": "<string>"
},
"primary_image_id": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
description_inherit_from_product: true,
primary_image_inherit_from_product: true,
reference: '<string>',
is_active: true,
category_ids: [{}],
inventory: {sku: '<string>'},
settings: {unit_per_pack: 123},
accounting: {ledger_account: '<string>'},
identifiers: {crm: '<string>', erp: '<string>', accounting: '<string>'},
shipping: {
weight: 123,
weight_unit: '<string>',
height: 123,
length: 123,
width: 123,
length_unit: '<string>',
country_of_origin: '<string>',
harmonized_system_code: '<string>'
},
primary_image_id: '<string>'
})
};
fetch('https://qwoty.app/api/products/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://qwoty.app/api/products/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'description_inherit_from_product' => true,
'primary_image_inherit_from_product' => true,
'reference' => '<string>',
'is_active' => true,
'category_ids' => [
[
]
],
'inventory' => [
'sku' => '<string>'
],
'settings' => [
'unit_per_pack' => 123
],
'accounting' => [
'ledger_account' => '<string>'
],
'identifiers' => [
'crm' => '<string>',
'erp' => '<string>',
'accounting' => '<string>'
],
'shipping' => [
'weight' => 123,
'weight_unit' => '<string>',
'height' => 123,
'length' => 123,
'width' => 123,
'length_unit' => '<string>',
'country_of_origin' => '<string>',
'harmonized_system_code' => '<string>'
],
'primary_image_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://qwoty.app/api/products/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"description_inherit_from_product\": true,\n \"primary_image_inherit_from_product\": true,\n \"reference\": \"<string>\",\n \"is_active\": true,\n \"category_ids\": [\n {}\n ],\n \"inventory\": {\n \"sku\": \"<string>\"\n },\n \"settings\": {\n \"unit_per_pack\": 123\n },\n \"accounting\": {\n \"ledger_account\": \"<string>\"\n },\n \"identifiers\": {\n \"crm\": \"<string>\",\n \"erp\": \"<string>\",\n \"accounting\": \"<string>\"\n },\n \"shipping\": {\n \"weight\": 123,\n \"weight_unit\": \"<string>\",\n \"height\": 123,\n \"length\": 123,\n \"width\": 123,\n \"length_unit\": \"<string>\",\n \"country_of_origin\": \"<string>\",\n \"harmonized_system_code\": \"<string>\"\n },\n \"primary_image_id\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://qwoty.app/api/products/{id}")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"description_inherit_from_product\": true,\n \"primary_image_inherit_from_product\": true,\n \"reference\": \"<string>\",\n \"is_active\": true,\n \"category_ids\": [\n {}\n ],\n \"inventory\": {\n \"sku\": \"<string>\"\n },\n \"settings\": {\n \"unit_per_pack\": 123\n },\n \"accounting\": {\n \"ledger_account\": \"<string>\"\n },\n \"identifiers\": {\n \"crm\": \"<string>\",\n \"erp\": \"<string>\",\n \"accounting\": \"<string>\"\n },\n \"shipping\": {\n \"weight\": 123,\n \"weight_unit\": \"<string>\",\n \"height\": 123,\n \"length\": 123,\n \"width\": 123,\n \"length_unit\": \"<string>\",\n \"country_of_origin\": \"<string>\",\n \"harmonized_system_code\": \"<string>\"\n },\n \"primary_image_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://qwoty.app/api/products/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"description_inherit_from_product\": true,\n \"primary_image_inherit_from_product\": true,\n \"reference\": \"<string>\",\n \"is_active\": true,\n \"category_ids\": [\n {}\n ],\n \"inventory\": {\n \"sku\": \"<string>\"\n },\n \"settings\": {\n \"unit_per_pack\": 123\n },\n \"accounting\": {\n \"ledger_account\": \"<string>\"\n },\n \"identifiers\": {\n \"crm\": \"<string>\",\n \"erp\": \"<string>\",\n \"accounting\": \"<string>\"\n },\n \"shipping\": {\n \"weight\": 123,\n \"weight_unit\": \"<string>\",\n \"height\": 123,\n \"length\": 123,\n \"width\": 123,\n \"length_unit\": \"<string>\",\n \"country_of_origin\": \"<string>\",\n \"harmonized_system_code\": \"<string>\"\n },\n \"primary_image_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"product_parent_id": "660e8400-e29b-41d4-a716-446655440001",
"workspace_id": "880e8400-e29b-41d4-a716-446655440003",
"name": "Updated Product Name",
"api_name": "updated_product_name",
"reference": "PROD-001",
"description": "Updated description",
"description_inherit_from_product": true,
"primary_image_inherit_from_product": true,
"is_active": false,
"is_default": true,
"catalogs": [
{
"id": "770e8400-e29b-41d4-a716-446655440002",
"name": "Catalogue principal",
"api_name": "catalog_main"
}
],
"categories": [],
"settings": {
"unit_per_pack": 1,
"product_type": "physical",
"language_code": null,
"unit_of_measure": null,
"recurrence_type": "one_off"
},
"shipping": {
"weight": 2.8,
"weight_unit": "kg",
"length": 30,
"width": 20,
"height": 10,
"length_unit": "cm",
"country_of_origin": "FR",
"harmonized_system_code": "8471.30"
},
"inventory": {
"sku": "WID-PRE-001"
},
"identifiers": {
"crm": "crm_123",
"accounting": "acc_789",
"erp": "erp_456"
},
"accounting": {
"ledger_account": "4010"
},
"primary_image_id": null,
"parent_primary_image_id": null,
"options": [],
"prices": [
{
"id": "ee0e8400-e29b-41d4-a716-446655440030",
"key": "updated_product_name.standard",
"pricebook": { "id": "ff0e8400-e29b-41d4-a716-446655440031", "name": "Standard", "api_name": "standard", "type": "fixed" },
"billing_frequency": null,
"pricing_model": "flat",
"amount": 1990
}
],
"created_at": "2024-12-21T10:30:00Z",
"updated_at": "2024-12-21T14:45:00Z"
}
}
Produits
Mettre à jour un produit
Mettre à jour un produit existant
PATCH
/
api
/
products
/
{id}
Mettre à jour un produit
curl --request PATCH \
--url https://qwoty.app/api/products/{id} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"description_inherit_from_product": true,
"primary_image_inherit_from_product": true,
"reference": "<string>",
"is_active": true,
"category_ids": [
{}
],
"inventory": {
"sku": "<string>"
},
"settings": {
"unit_per_pack": 123
},
"accounting": {
"ledger_account": "<string>"
},
"identifiers": {
"crm": "<string>",
"erp": "<string>",
"accounting": "<string>"
},
"shipping": {
"weight": 123,
"weight_unit": "<string>",
"height": 123,
"length": 123,
"width": 123,
"length_unit": "<string>",
"country_of_origin": "<string>",
"harmonized_system_code": "<string>"
},
"primary_image_id": "<string>"
}
'import requests
url = "https://qwoty.app/api/products/{id}"
payload = {
"name": "<string>",
"description": "<string>",
"description_inherit_from_product": True,
"primary_image_inherit_from_product": True,
"reference": "<string>",
"is_active": True,
"category_ids": [{}],
"inventory": { "sku": "<string>" },
"settings": { "unit_per_pack": 123 },
"accounting": { "ledger_account": "<string>" },
"identifiers": {
"crm": "<string>",
"erp": "<string>",
"accounting": "<string>"
},
"shipping": {
"weight": 123,
"weight_unit": "<string>",
"height": 123,
"length": 123,
"width": 123,
"length_unit": "<string>",
"country_of_origin": "<string>",
"harmonized_system_code": "<string>"
},
"primary_image_id": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
description_inherit_from_product: true,
primary_image_inherit_from_product: true,
reference: '<string>',
is_active: true,
category_ids: [{}],
inventory: {sku: '<string>'},
settings: {unit_per_pack: 123},
accounting: {ledger_account: '<string>'},
identifiers: {crm: '<string>', erp: '<string>', accounting: '<string>'},
shipping: {
weight: 123,
weight_unit: '<string>',
height: 123,
length: 123,
width: 123,
length_unit: '<string>',
country_of_origin: '<string>',
harmonized_system_code: '<string>'
},
primary_image_id: '<string>'
})
};
fetch('https://qwoty.app/api/products/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://qwoty.app/api/products/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'description_inherit_from_product' => true,
'primary_image_inherit_from_product' => true,
'reference' => '<string>',
'is_active' => true,
'category_ids' => [
[
]
],
'inventory' => [
'sku' => '<string>'
],
'settings' => [
'unit_per_pack' => 123
],
'accounting' => [
'ledger_account' => '<string>'
],
'identifiers' => [
'crm' => '<string>',
'erp' => '<string>',
'accounting' => '<string>'
],
'shipping' => [
'weight' => 123,
'weight_unit' => '<string>',
'height' => 123,
'length' => 123,
'width' => 123,
'length_unit' => '<string>',
'country_of_origin' => '<string>',
'harmonized_system_code' => '<string>'
],
'primary_image_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://qwoty.app/api/products/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"description_inherit_from_product\": true,\n \"primary_image_inherit_from_product\": true,\n \"reference\": \"<string>\",\n \"is_active\": true,\n \"category_ids\": [\n {}\n ],\n \"inventory\": {\n \"sku\": \"<string>\"\n },\n \"settings\": {\n \"unit_per_pack\": 123\n },\n \"accounting\": {\n \"ledger_account\": \"<string>\"\n },\n \"identifiers\": {\n \"crm\": \"<string>\",\n \"erp\": \"<string>\",\n \"accounting\": \"<string>\"\n },\n \"shipping\": {\n \"weight\": 123,\n \"weight_unit\": \"<string>\",\n \"height\": 123,\n \"length\": 123,\n \"width\": 123,\n \"length_unit\": \"<string>\",\n \"country_of_origin\": \"<string>\",\n \"harmonized_system_code\": \"<string>\"\n },\n \"primary_image_id\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://qwoty.app/api/products/{id}")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"description_inherit_from_product\": true,\n \"primary_image_inherit_from_product\": true,\n \"reference\": \"<string>\",\n \"is_active\": true,\n \"category_ids\": [\n {}\n ],\n \"inventory\": {\n \"sku\": \"<string>\"\n },\n \"settings\": {\n \"unit_per_pack\": 123\n },\n \"accounting\": {\n \"ledger_account\": \"<string>\"\n },\n \"identifiers\": {\n \"crm\": \"<string>\",\n \"erp\": \"<string>\",\n \"accounting\": \"<string>\"\n },\n \"shipping\": {\n \"weight\": 123,\n \"weight_unit\": \"<string>\",\n \"height\": 123,\n \"length\": 123,\n \"width\": 123,\n \"length_unit\": \"<string>\",\n \"country_of_origin\": \"<string>\",\n \"harmonized_system_code\": \"<string>\"\n },\n \"primary_image_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://qwoty.app/api/products/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"description_inherit_from_product\": true,\n \"primary_image_inherit_from_product\": true,\n \"reference\": \"<string>\",\n \"is_active\": true,\n \"category_ids\": [\n {}\n ],\n \"inventory\": {\n \"sku\": \"<string>\"\n },\n \"settings\": {\n \"unit_per_pack\": 123\n },\n \"accounting\": {\n \"ledger_account\": \"<string>\"\n },\n \"identifiers\": {\n \"crm\": \"<string>\",\n \"erp\": \"<string>\",\n \"accounting\": \"<string>\"\n },\n \"shipping\": {\n \"weight\": 123,\n \"weight_unit\": \"<string>\",\n \"height\": 123,\n \"length\": 123,\n \"width\": 123,\n \"length_unit\": \"<string>\",\n \"country_of_origin\": \"<string>\",\n \"harmonized_system_code\": \"<string>\"\n },\n \"primary_image_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"product_parent_id": "660e8400-e29b-41d4-a716-446655440001",
"workspace_id": "880e8400-e29b-41d4-a716-446655440003",
"name": "Updated Product Name",
"api_name": "updated_product_name",
"reference": "PROD-001",
"description": "Updated description",
"description_inherit_from_product": true,
"primary_image_inherit_from_product": true,
"is_active": false,
"is_default": true,
"catalogs": [
{
"id": "770e8400-e29b-41d4-a716-446655440002",
"name": "Catalogue principal",
"api_name": "catalog_main"
}
],
"categories": [],
"settings": {
"unit_per_pack": 1,
"product_type": "physical",
"language_code": null,
"unit_of_measure": null,
"recurrence_type": "one_off"
},
"shipping": {
"weight": 2.8,
"weight_unit": "kg",
"length": 30,
"width": 20,
"height": 10,
"length_unit": "cm",
"country_of_origin": "FR",
"harmonized_system_code": "8471.30"
},
"inventory": {
"sku": "WID-PRE-001"
},
"identifiers": {
"crm": "crm_123",
"accounting": "acc_789",
"erp": "erp_456"
},
"accounting": {
"ledger_account": "4010"
},
"primary_image_id": null,
"parent_primary_image_id": null,
"options": [],
"prices": [
{
"id": "ee0e8400-e29b-41d4-a716-446655440030",
"key": "updated_product_name.standard",
"pricebook": { "id": "ff0e8400-e29b-41d4-a716-446655440031", "name": "Standard", "api_name": "standard", "type": "fixed" },
"billing_frequency": null,
"pricing_model": "flat",
"amount": 1990
}
],
"created_at": "2024-12-21T10:30:00Z",
"updated_at": "2024-12-21T14:45:00Z"
}
}
Autorisation
string
requis
Jeton Bearer pour l’authentification. Format :
Bearer qwoty_your_tokenParamètres de chemin
string
requis
UUID du produit à mettre à jour
Corps de la requête
string
Nom du produit
string
Description du produit
boolean
Indique si la description doit être héritée du produit parent
boolean
Indique si l’image principale doit être héritée du produit parent
string
Référence interne
boolean
Statut actif
array
UUIDs de catégories à associer au produit parent. Remplace tous les liens de
catégories existants.
object
object
Informations de livraison
string
UUID du média principal à associer à ce produit. Définir à
null pour
supprimer l’image principale.api_name sont réservés à la création : ils peuvent apparaître sur la ressource mais ne peuvent pas être envoyés dans un corps PATCH (l’API retourne 400 avec un détail de validation s’ils sont inclus).
Exemples
curl -X PATCH https://qwoty.app/api/products/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer qwoty_your_token" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Product Name",
"description": "Updated description",
"is_active": false
}'
const productId = '550e8400-e29b-41d4-a716-446655440000'
const response = await fetch(`https://qwoty.app/api/products/${productId}`, {
method: 'PATCH',
headers: {
Authorization: 'Bearer qwoty_your_token',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Updated Product Name',
description: 'Updated description',
is_active: false,
}),
})
const data = await response.json()
import requests
product_id = '550e8400-e29b-41d4-a716-446655440000'
response = requests.patch(
f'https://qwoty.app/api/products/{product_id}',
headers={
'Authorization': 'Bearer qwoty_your_token',
'Content-Type': 'application/json'
},
json={
'name': 'Updated Product Name',
'description': 'Updated description',
'is_active': False
}
)
data = response.json()
Réponse
boolean
Indique si la requête a réussi
object
L’objet produit mis à jour avec tous les champs, y compris le tableau
prices{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"product_parent_id": "660e8400-e29b-41d4-a716-446655440001",
"workspace_id": "880e8400-e29b-41d4-a716-446655440003",
"name": "Updated Product Name",
"api_name": "updated_product_name",
"reference": "PROD-001",
"description": "Updated description",
"description_inherit_from_product": true,
"primary_image_inherit_from_product": true,
"is_active": false,
"is_default": true,
"catalogs": [
{
"id": "770e8400-e29b-41d4-a716-446655440002",
"name": "Catalogue principal",
"api_name": "catalog_main"
}
],
"categories": [],
"settings": {
"unit_per_pack": 1,
"product_type": "physical",
"language_code": null,
"unit_of_measure": null,
"recurrence_type": "one_off"
},
"shipping": {
"weight": 2.8,
"weight_unit": "kg",
"length": 30,
"width": 20,
"height": 10,
"length_unit": "cm",
"country_of_origin": "FR",
"harmonized_system_code": "8471.30"
},
"inventory": {
"sku": "WID-PRE-001"
},
"identifiers": {
"crm": "crm_123",
"accounting": "acc_789",
"erp": "erp_456"
},
"accounting": {
"ledger_account": "4010"
},
"primary_image_id": null,
"parent_primary_image_id": null,
"options": [],
"prices": [
{
"id": "ee0e8400-e29b-41d4-a716-446655440030",
"key": "updated_product_name.standard",
"pricebook": { "id": "ff0e8400-e29b-41d4-a716-446655440031", "name": "Standard", "api_name": "standard", "type": "fixed" },
"billing_frequency": null,
"pricing_model": "flat",
"amount": 1990
}
],
"created_at": "2024-12-21T10:30:00Z",
"updated_at": "2024-12-21T14:45:00Z"
}
}
Réponses d’erreur
{
"success": false,
"error": "Product not found"
}
{
"success": false,
"error": "Validation error",
"details": {
"name": "Name must be at least 2 characters"
}
}
{
"error": "Validation error",
"details": ["Field 'reference' is read-only or unknown"]
}
{
"success": false,
"error": "Invalid or expired token"
}
Dernière modification le 28 octobre 2026
Cette page vous a-t-elle été utile ?

