How would I do this:
var url = "https://api.trello.com/1/cards/{idCard}/customField/{idCustomField}/item?token={yourToken}&key={yourKey}";
var data = {value: { number: "42" }};
fetch(url, { body: JSON.stringify(data), method: 'PUT', headers: {'content-type': 'application/json'}})
.then((resp) => resp.json())
.then((data) => console.log(JSON.stringify(data, null, 2)))
.catch((err) => console.log(JSON.stringify(err, null, 2)))
In order to change the options in a pre-defined custom field on a card,
However I can’t use fetch on google scripts, I’m constrained to using google’s “UrlFetchApp.fetch”
class Class UrlFetchApp | Apps Script | Google Developers
I’ve attempted this:
var url = "https://api.trello.com/1/cards/" + cardId + "/customField/[CustomID]/item?token=[Token]&key=[Key]";
var data = {value: { "text": "42" }};
var payload = {"customField" : data};
var options = {"method" : "put",
"payload" : payload};
UrlFetchApp.fetch(url,options);
But I get this error But I get this error:
Request failed for https://api.trello.com returned code 400. Truncated server response: Invalid value for custom field type
Thank you in advance!