I'm trying to make API calls to the Google Analytics API v3. Simple read-only calls work just fine, but when trying to update data views (or any update method) I always end up with the following response:

 "error": {
  "errors": [
    "domain": "global",
    "reason": "required",
    "message": "Field name is required."
  "code": 400,
  "message": "Field name is required."

This is true even when using API explorer. Since read-only requests work I think errors regarding account, property and view ids can be dismissed. And as "fields" only specifies, what to include in a response I assume the error is with the request body. To produce a minimal working example I restrained to the structured editor, which allows you to pick key-value pairs for the preference you wish to change, e.g.:


However, the error is still the same. The documentation seems rather scarce regarding the request body specifications asking you to provide a management.prilfe.resource object, which is not well documented.

Can somebody show me what a valid request body needs to look like (if this is where my error lies)?


@SomewhereDave got me on the right track. If anybody runs into the same issue, here's how I solved it.

Caveats: I'm using googleapis Node.js library, authenticate via JWT (service-to-service credentials) and have a global client configured for the Google Analytics API v.3

  1. (Assuming that you know the account and web property IDs),make a analytics.management.webproperties.get call to get the existing JSON of properties.
  2. Pass the JSON, accountId, an webpropertyID to an analytics.management.webproperties.update call.
  3. Update the property name(s) you need in the JSON.
const getPropertyJson = async (account, property) => {
    const params = {
    const result = await analytics.management.webproperties.get(params)
    return result

const updateExistingProperty = async (account, property, propertyJson) => {
    const params = {
        requestBody: propertyJson

    params.requestBody.industryVertical = 'REFERENCE'

    const result = await analytics.management.webproperties.update(params)
    return result

The response.data will return the updated JSON with all properties.


Apparently, you have to provide a JSON object as the request body including values for all possible keys. So, if you want to change your view's name you also provide the id, currency, timezone, etc. unchanged.

I guess the easiest way to achieve this is to use a get request for the view first, make changes to the keys you want to change for the resulting JSON and use it with your update request.

This is what a full request body should look like for a view update

  "id": "123456789",
  "kind": "analytics#profile",
  "selfLink": "https://www.googleapis.com/analytics/v3/management/accounts/12345678/webproperties/UA-12345678-1/profiles/123456789",
  "accountId": "12345678",
  "webPropertyId": "UA-12345678-1",
  "internalWebPropertyId": "111111111",
  "name": "My view",
  "currency": "USD",
  "timezone": "America/Los_Angeles",
  "websiteUrl": "http://mygreatwebsite.org",
  "type": "WEB",
  "permissions": {
    "effective": [
  "created": "2018-08-13T15:17:29.661Z",
  "updated": "2018-08-13T15:17:29.661Z",
  "eCommerceTracking": false,
  "parentLink": {
    "type": "analytics#webproperty",
    "href": "https://www.googleapis.com/analytics/v3/management/accounts/12345678/webproperties/UA-12345678-1"
  "childLink": {
    "type": "analytics#goals",
    "href": "https://www.googleapis.com/analytics/v3/management/accounts/12345678/webproperties/UA-12345678-1/profiles/123456789/goals"

Simple change the values for the variable keys you want to alter and put it into --data 'JSON goes here' of your PUT request.

This might also be the reason why you have to provide values for all possible fields:

The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI."

More info here and here.

The endpoint is probably simply overriding existing configurations instead of updating individual fields.

It's kind of odd that you are required to provide so much useless overhead and it's not stated anywhere in the documentation. From an outside perspective you'd think the view, property and account id would suffice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.