var json = JSON.stringify({
offer_id: YOUR_OFFER_ID,
product_id: YOUR_PRODUCT_ID,
sku: YOUR_SKU
});
var xhr = new XMLHttpRequest();
xhr.open('POST', 'https://адрес_куда_делать_запрос');
xhr.setRequestHeader('Client-Id', 'Впишите здесь свой ID');
xhr.setRequestHeader('Api-Key', 'Впишите здесь свой ключ');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
var obj = JSON.parse(xhr.responseText);
console.log('Успех:');
console.dir(obj);
}
else {
console.log('Ошибка:');
console.dir(xhr);
}
}
}
xhr.send(json);