I need to do a PUT method.
The API manual brings example codes only in CURL or PHP. I need help to translate this to app script.
Here is the code from the manual:
Here are my variables:
idLoja = 203700218
codigo = HSSK81CASACORKITRS
apikey = 7a45522de52056f24f56386833fcdc2f3a905a92df9080728e1570ac1a7683510fb43398
My code is as follows, but it is not working. It returns that the API key parameter was not found. I need help!
function putProduct() {
var url = 'https://bling.com.br/Api/v2/produtoLoja/203700218/HSSK81CASACORKITRS/json/?apikey=7a45522de52056f24f56386833fcdc2f3a905a92df9080728e1570ac1a7683510fb43398'
     var payload = {xml: '<?xml version="1.0" encoding="UTF-8"?> 
   <produtosLoja> 
   <produtoLoja<idLojaVirtual>203700218</idLojaVirtual> 
   <preco> 
  <preco>415,98</preco<precoPromocional>389,99</precoPromocional> 
  </preco><idFornecedor>0</idFornecedor><idMarca>2</idMarca> 
  <categoriasLoja><categoriaLoja> 
  <idCategoria>3709181</idCategoria> 
  </categoriaLoja></categoriasLoja></produtoLoja></produtosLoja>'
   };
const options =
 {
 method: 'PUT',
 followRedirects: true,
 muteHttpExceptions: true,
 payload: payload,
 };
var response = UrlFetchApp.fetch(url,options);
Logger.log(response.getContentText()); 
}

