Ajouter un produit
Name
Value
Name
Type
Description
curl -X POST https://ovh-backend.altec-ts.fr/api/addProduct \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_access_token" \
-d '{
"productLogin": <your_product_login>,
"productKey": <your_product_key>
}'const url = 'https://ovh-backend.altec-ts.fr/api/addProduct';
const data = {
productLogin: <your_product_login>,
productKey: <your_product_key>,
};
const headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer your_access_token'
};
fetch(url, {
method: 'POST',
headers,
body: JSON.stringify(data)
})
.then(response => {
if (!response.ok) {
// Gérer les réponses non 200
return response.json().then(errData => {
console.log("status:", response.status);
console.log("message:", errData.error || "An error has occurred");
});
}
console.log('OK');
})
.catch(error => {
if (error.name === 'AbortError') {
console.log("message: No response received from server");
} else {
console.log('error.message:', error.message);
}
});Mis à jour