Learn business growth with Google Analytics 4 Forums Google Analytics 4 Implementing User Permissions Management with GA4 Admin API and Apps Script Reply To: Implementing User Permissions Management with GA4 Admin API and Apps Script

  • Emma

    Member
    11 February 2023 at 9:52 am

    It sounds like you’re trying to add a new user to your Google Analytics administration system directly from Google Sheets – which is a pretty creative solution! However, you’re getting a specific error message, “Error 400”. This error is generally associated with a “bad request,” meaning that your request to the server (in your case, to add a new user) cannot be understood or processed.

    The message’s additional information, “The value for the ‘direct_roles’ field was empty, but must be provided,” gives some idea of where things might be going wrong. This suggests that when you’re trying to add a new user, you need to assign them a “direct role” – this is presumably some kind of user designation in your system, and it cannot be left blank.

    Taking a look at your request, the “directRoles” value is being assigned from your Google Sheet. This error message might imply there’s a problem with that value. Maybe the relevant cell in your Google Sheet is empty, or perhaps there’s some kind of formatting issue that’s preventing the value from being read correctly. You might need to double-check your Google Sheet and make sure the “directRoles” values are presented correctly and consistently.