JavaScript
0
Вклад в тег
const url = `https://crm.testdomen.ru/rest/${idAuth}/${keyAuth}/crm.lead.add.json`;
fetch(url, {
method: 'post',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
fields: data.fields
})
})
.then(function (response) {
loader.classList.add("hiden");
success.classList.remove("hiden");
return console.log('Request succeeded', response.json());
})
.catch(function (error) {
loader.classList.add("hiden");
fail.classList.remove("hiden");
console.log('Request failed', error);
});
};
let data = {
fields: {
TITLE: "",
NAME: "",
STATUS_ID: "20",
OPENED: "20",
LAST_NAME: "",
SOURCE_ID: "",
POST: "",
BIRTHDATE: "",
UF_CRM_KOMMENTARII: '',
UF_CRM_1545200238: '216', // тип лида
PHONE: [{
VALUE: "",
VALUE_TYPE: "WORK"
}],
EMAIL: [{
VALUE_TYPE: "WORK",
VALUE: "",
}],
WEB: [{
VALUE_TYPE: "WORK",
VALUE: "",
}]
},
params: {
"REGISTER_SONET_EVENT": "Y"
}
}