4 Replies Latest reply on Mar 4, 2016 9:29 AM by lkoczorowski

    Request API PUT problem




      I have this very simple function. I stripped everything from it expect the bare minimum to have a fetch request.

      Basically we want to change group type to PRIVATE.

      It runs, no error, and the groupType is not changed.

      I take exactly the same parameters into a POSTMAN chrome extension (extension to run HTTP requests) and the groupType is changed.

      I spent several hours on the problem and I don't understand what is going on.



      function changeGroupType(){

        var data = JSON.stringify({"type": "group", "groupType": "PRIVATE"});

        var options = {

          "method" : "PUT",

          "contentType" : "application/json;charset=utf-8",


          "headers" : {

            "Authorization": "Basic xxxxxxxxxxxxx=="


          "payload" : data


        var res = UrlFetchApp.fetch("https://lafarge.jiveon.com/api/core/v3/places/89172", options);

        json =json.slice(43);

        var dataJson = JSON.parse(json);

        Logger.log( dataJson.groupType);



      I'd appreciate some help on it.