const articles = [
{ articleCode: 'CAM-PEEK-40', name: 'Came PEEK Ø40', unit: 'pce' },
{ articleCode: 'CAM-PEEK-50', name: 'Came PEEK Ø50', unit: 'pce' },
];
for (const article of articles) {
const res = await fetch(`${process.env.BONX_API_URL}/articles`, {
method: 'POST',
headers: { 'x-api-key': process.env.BONX_API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify(article),
});
if (!res.ok) console.error('Échec pour', article.articleCode, await res.text());
}
curl -X POST "$BONX_API_URL/articles" \
-H "x-api-key: $BONX_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "articleCode": "CAM-PEEK-40", "name": "Came PEEK Ø40", "unit": "pce" }'
Traitez les articles par lots et espacez les requêtes si votre import est volumineux.