bulkUpdate method

Future<BulkUpdateWorkspaceResponse> bulkUpdate(
  1. ProposedChange request,
  2. String path, {
  3. String? $fields,
})

Applies multiple entity changes to a workspace in one call.

When creating new entities, their entity IDs must be unique and in correct format. That is, they must start with "new_" and followed by number, e.g. "new_1", "new_2". Example body snippet to create myNewTag under myNewFolder is: "changes": [ { "folder": { "folderId": "new_1", "name": "myNewFolder", ... }, "changeStatus": "added" }, { "tag": { "tagId": "new_2", "name": "myNewTag", "parentFolderId": "new_1", ... }, "changeStatus": "added" } ]

request - The metadata request object.

Request parameters:

path - GTM Workspace's API relative path. Value must have pattern ^accounts/\[^/\]+/containers/\[^/\]+/workspaces/\[^/\]+$.

$fields - Selector specifying which fields to include in a partial response.

Completes with a BulkUpdateWorkspaceResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<BulkUpdateWorkspaceResponse> bulkUpdate(
  ProposedChange request,
  core.String path, {
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    'fields': ?$fields == null ? null : [$fields],
  };

  final url_ =
      'tagmanager/v2/' + core.Uri.encodeFull('$path') + '/bulk_update';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return BulkUpdateWorkspaceResponse.fromJson(
    response_ as core.Map<core.String, core.dynamic>,
  );
}