Hope your doing good. I have a requirement where need to iterate all requesters, update custom check value for that requester. in loop if i am trying update custom field check box it is not updating, but status coming as 200. but if i try same body in postman it is updating. Can you guys help me any other work around need to proceed.
This is body i am sending and using v2 API update requester
“custom_fields”: {
“custom_check”: true
}
Thanks in advance,
Tejasri Kalluri.
As @sarfaraz_Mohammed mentioned, the code snippet of how the loop is performed and how the complete request is made is available, that would help you troubleshoot it further.
Hi @Raviraj,
This is code using in forloop,
var headers = { “Authorization”: “Basic cmZDY0s1cGFRcGJPUmRqclg3aTo=” };
var options = { headers: headers };
var url = https://artisinc.freshservice.com/api/v2/requesters?page=${page}&per_page=100;
console.log(url)
$request.get(url, options).then(function (data) {
try {
var resp = JSON.parse(data.response);
for (var i = 0; i < resp.requesters.length; i++) {
if (resp.requesters[i].active && resp.requesters[i].custom_fields.custom_check !== null) {
if (resp.requesters[i].custom_fields.custom_check === false)
updateRequesterField(resp.requesters[i].id);
}
}
if (resp.requesters.length === 100) {
page = page + 1;
get_all_contacts(page);
}
Thanks for sharing the code snippets.
In the request, you are trying to update the custom field. It is a PUT method and not a GET. Can you change that and let us know if it works?