Accounts: custombatch

Requires authorization

Retrieves, inserts, updates, and deletes multiple Merchant Center (sub-)accounts in a single request. Try it now.

Request

HTTP request

POST https://www.googleapis.com/content/v2/accounts/batch

Parameters

Parameter name Value Description
Optional query parameters
dryRun boolean Flag to run the request in dry-run mode.

Authorization

This request requires authorization with the following scope (read more about authentication and authorization).

Scope
https://www.googleapis.com/auth/content

Request body

In the request body, supply data with the following structure:

JSON

{
  "entries": [
    {
      "batchId": unsigned integer,
      "merchantId": unsigned long,
      "method": string,
      "accountId": unsigned long,
      "account": accounts Resource,
      "overwrite": boolean,
      "force": boolean
    }
  ]
}
Property name Value Description Notes
entries[] list The request entries to be processed in the batch.
entries[].batchId unsigned integer An entry ID, unique within the batch request.
entries[].merchantId unsigned long The ID of the managing account.
entries[].method string

Acceptable values are:
  • "claimWebsite"
  • "delete"
  • "get"
  • "insert"
  • "update"
entries[].accountId unsigned long The ID of the targeted account. Only defined if the method is get, delete or claimwebsite.
entries[].account nested object The account to create or update. Only defined if the method is insert or update.
entries[].overwrite boolean Only applicable if the method is claimwebsite. Indicates whether or not to take the claim from another account in case there is a conflict.
entries[].force boolean Whether the account should be deleted if the account has offers. Only applicable if the method is delete.

XML

<batch>
  (foreach)
    <entry batch_id="unsigned integer" method="string">
      <merchant_id>
        unsigned long
      </merchant_id>
      <account_id>
        unsigned long
      </account_id>
      accounts Resource
    </entry>
  (/foreach)
</batch>
Property name Value Description Notes
batch object
batch/entry object A batch entry encoding a single non-batch accounts request.
batch/entry/batch_id unsigned integer An entry ID, unique within the batch request.
batch/entry/method string The method of the batch entry.

Acceptable values are:
  • "delete"
  • "get"
  • "insert"
  • "update"
batch/entry/merchant_id unsigned long The ID of the managing account.
batch/entry/account_id unsigned long The ID of the targeted account. Only defined if the method is get, delete or claimwebsite.
batch/entry/account nested object The account to create or update. Only defined if the method is insert or update. Account data.

Response

If successful, this method returns a response body with the following structure:

JSON

{
  "kind": "content#accountsCustomBatchResponse",
  "entries": [
    {
      "kind": "content#accountsCustomBatchResponseEntry",
      "batchId": unsigned integer,
      "account": accounts Resource,
      "errors": {
        "errors": [
          {
            "domain": string,
            "reason": string,
            "message": string
          }
        ],
        "code": unsigned integer,
        "message": string
      }
    }
  ]
}
Property name Value Description Notes
kind string Identifies what kind of resource this is. Value: the fixed string "content#accountsCustomBatchResponse".
entries[] list The result of the execution of the batch requests.
entries[].kind string Identifies what kind of resource this is. Value: the fixed string "content#accountsCustomBatchResponseEntry".
entries[].batchId unsigned integer The ID of the request entry this entry responds to.
entries[].account nested object The retrieved, created, or updated account. Not defined if the method was delete or claimwebsite.
entries[].errors nested object A list of errors defined if and only if the request failed.
entries[].errors.errors[] list A list of errors.
entries[].errors.errors[].domain string The domain of the error.
entries[].errors.errors[].reason string The error code.
entries[].errors.errors[].message string A description of the error.
entries[].errors.code unsigned integer The HTTP status of the first error in errors.
entries[].errors.message string The message of the first error in errors.

XML

<batch>
  (foreach)
    <entry batch_id="unsigned integer">
      accounts Resource
      <errors xmlns="http://schemas.google.com/g/2005">
        (foreach)
          <error>
            <domain>
              GData
              string
            </domain>
            <code>
              string
            </code>
            <internalReason>
              string
            </internalReason>
          </error>
        (/foreach)
      </errors>
    </entry>
  (/foreach)
</batch>
Property name Value Description Notes
batch object
batch/entry object A batch entry encoding a single non-batch accounts response.
batch/entry/batch_id unsigned integer The ID of the request entry this entry responds to.
batch/entry/errors nested object A list of errors defined if and only if the request failed. A list of errors returned by a failed batch entry.
batch/entry/errors/error object A list of errors. An error returned by the API.
batch/entry/errors/error/domain string The domain of the error.
batch/entry/errors/error/code string The error code.
batch/entry/errors/error/internalReason string A description of the error.
batch/entry/account nested object The retrieved, created, or updated account. Not defined if the method was delete or claimwebsite. Account data.

Try it!

Use the APIs Explorer below to call this method on live data and see the response.

Send feedback about...

Content API for Shopping