Bulk Updating End Users API Fails


  • Morris Coyle

    A brief follow up on this; i have since changed the POST to PUT but still getting invalid endpoints error

  • Morris Coyle

    Another update (I'm like a dog with a bone on this one :-) )

    I realised that my endpoint was still wrong and it should be 

    Now the issue i am getting is this:
    { "error": { "title": "Invalid attribute", "message": "You passed an invalid value for the users attribute. Invalid parameter: users must be an array from api/v2/users/update_many" } }
  • Morris Coyle

    If this is ever of use to anyone else I have solved my issue with help from Stack Overflow; updated script is below:


    function updateManyUsers() {
    varsheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sheet1');
    var [headers, ...rows] = sheet.getDataRange().getDisplayValues();
    varusers = rows.map(r => {
    vartemp = {};
    headers.forEach((h, j) => {
    if (r[j] != "") temp[h] = r[j];
    varuser = 'morris.coyle@retacted/token';
    varpwd = 'redacted';
    varoptions = {
    'method': 'PUT',
    'headers': {
    'Authorization': "Basic " + Utilities.base64Encode(user + ':' + pwd)
    'payload': JSON.stringify({ users }),
    'contentType': 'application/json',
    'muteHttpExceptions': true
    varresponse = UrlFetchApp.fetch(url, options);
  • CJ Johnson

    Hey Morris! I don't have anything helpful to add here, I'm just thrilled to see someone else fighting with Google Apps Script and Zendesk, and that you posted your solution. It took me a week just to get authentication working the first time I tried to set up a script.  Thank you for posting this, I've got a project coming up in a similar vein and you just saved me a LOT of time. 


Please sign in to leave a comment.

Powered by Zendesk