遷移使用者和存取權管理
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
在 Content API for Shopping 中,您是透過 Account
資源中的欄位管理使用者和存取權。Merchant API 會以名為 User
的專屬資源和對應方法 (create、delete、get、list、path) 取代這項資源。詳情請參閱控管帳戶存取權。
主要差異
相較於 Content API for Shopping,Merchant API 在使用者管理方面具有下列優勢:
- 專屬資源:提供更精細且直接的方式,控管誰能存取 Merchant Center 帳戶及可執行的操作。
- 符合 REST 樣式的資源名稱:在 Merchant API 中,使用完整資源名稱 (例如
accounts/12345/users/example@example.com
) 識別 User
資源。
me
別名:您可以在資源名稱中使用別名 me
,取代電子郵件地址來參照已驗證的使用者,例如 accounts/12345/users/me
。
- 整合存取權:Merchant API 會將 Content API 中的布林存取權欄位 (例如
admin
、reportingManager
) 整合為單一可重複的 access_rights
欄位。
- 使用者邀請和驗證:Merchant API 導入明確的使用者狀態 (
PENDING
或 VERIFIED
)。建立新使用者時,他們會處於 PENDING
狀態,直到接受邀請為止。這項功能可透過 API 查看使用者狀態,Content API for Shopping 則無法提供這項資訊。新增
## 要求
Merchant API 使用下列要求網址管理使用者:
GET /accounts/v1/accounts/{account}/users/{email}
GET /accounts/v1/accounts/{account}/users
POST /accounts/v1/accounts/{account}/users
PATCH /accounts/v1/accounts/{account}/users/{email}
DELETE /accounts/v1/accounts/{account}/users/{email}
下表比較了 Content API for Shopping 和 Merchant API 的要求網址。
要求說明 |
Content API for Shopping |
Merchant API |
取得帳戶使用者 |
GET {api_version}/{merchantId}/accounts/{accountId} |
GET {api_version}/accounts/{account}/users |
新增使用者 |
PATCH {api_version}/{merchantId}/accounts/{accountId} |
POST {api_version}/accounts/{account}/users |
更新使用者 |
PATCH {api_version}/{merchantId}/accounts/{accountId} |
PATCH {api_version}/accounts/{account}/users/{email} |
刪除使用者 |
PATCH {api_version}/{merchantId}/accounts/{accountId} |
DELETE {api_version}/accounts/{account}/users/{email} |
ID
下表比較 Content API for Shopping 和 Merchant API 中要求使用的 ID。
ID 說明 |
Content API for Shopping |
Merchant API |
帳戶 ID |
accountId |
accounts/{account} 的account |
使用者 ID |
email_address 內 AccountUser 物件 |
accounts/{account}/users/{email} 的email |
方法
下表比較 Content API for Shopping 和 Merchant API 的方法。
詳細欄位變更
請按照下列方式更新欄位的使用方式:
Content API for Shopping |
Merchant API |
說明 |
users (重複 AccountUser ) |
users (重複 User ) |
User 資源現在是頂層資源,有專屬服務。 |
AccountUser.email_address |
CreateUserRequest.user_id ,以及 User.name |
使用者的電子郵件地址現在是資源名稱的一部分。在建立時於 user_id 欄位中指定。 |
AccountUser.admin |
access_rights: "ADMIN" |
商家 API 會以 access_rights 列舉中的 ADMIN 值,取代布林值 admin 欄位。 |
AccountUser.order_manager 、AccountUser.payments_manager 、AccountUser.payments_analyst |
access_rights: "STANDARD" |
Merchant API 會取代這些角色,以取得STANDARD 存取權。 |
AccountUser.reporting_manager |
access_rights: "PERFORMANCE_REPORTING" |
reporting_manager 角色現在是 PERFORMANCE_REPORTING 存取權。 |
AccountUser.read_only |
access_rights: "READ_ONLY" |
read_only 角色現在是 READ_ONLY 存取權。 |
不適用 |
User.name |
包含使用者的完整資源名稱,例如 accounts/{account}/users/{email} 。 |
不適用 |
User.state |
指出使用者的邀請狀態,可能是 PENDING 或 VERIFIED 。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-08 (世界標準時間)。
[null,null,["上次更新時間:2025-08-08 (世界標準時間)。"],[],[],null,["# Migrate user and access management\n\nIn Content API for Shopping, you managed users and their access rights with a\nfield in the `Account` resource. Merchant API replaces this with the dedicated\nresource named\n[`User`](/merchant/api/reference/rest/accounts_v1/accounts.users) and\ncorresponding methods (create, delete, get, list, path). For more information,\nsee [Control access to your\naccount](/merchant/api/guides/accounts/control-access).\n\nKey differences\n---------------\n\nCompared to Content API for Shopping, Merchant API offers the following\nadvantages for user management:\n\n- **Dedicated resource**: This provides a more granular and direct way to control who can access your Merchant Center account and what they can do.\n- **RESTful resource names** : In Merchant API, identify `User` resources by a full resource name, for example, `accounts/12345/users/example@example.com`.\n- **`me` alias** : You can use the alias `me` in place of an email address in the resource name to refer to the authenticated user, for example, `accounts/12345/users/me`.\n- **Consolidated access rights** : Merchant API consolidates boolean access fields from Content API (for example, `admin`, `reportingManager`) into a single, repeatable`access_rights` field.\n- **User invitation and verification** : Merchant API introduces an explicit user state (`PENDING` or `VERIFIED`). When you create a new user, they are in a `PENDING` state until they accept the invitation. This provides API visibility into the user's status, which was not available in the Content API for Shopping. Add ## Requests\n\nMerchant API uses the following request URLs to manage users:\n\n- `GET /accounts/v1/accounts/{account}/users/{email}`\n- `GET /accounts/v1/accounts/{account}/users`\n- `POST /accounts/v1/accounts/{account}/users`\n- `PATCH /accounts/v1/accounts/{account}/users/{email}`\n- `DELETE /accounts/v1/accounts/{account}/users/{email}`\n\nThe following table compares the request URLs between the Content API for\nShopping and Merchant API.\n\n| Request description | Content API for Shopping | Merchant API |\n|--------------------------|---------------------------------------------------------|---------------------------------------------------------|\n| Get users for an account | `GET {api_version}/{merchantId}/accounts/{accountId}` | `GET {api_version}/accounts/{account}/users` |\n| Create a user | `PATCH {api_version}/{merchantId}/accounts/{accountId}` | `POST {api_version}/accounts/{account}/users` |\n| Update a user | `PATCH {api_version}/{merchantId}/accounts/{accountId}` | `PATCH {api_version}/accounts/{account}/users/{email}` |\n| Delete a user | `PATCH {api_version}/{merchantId}/accounts/{accountId}` | `DELETE {api_version}/accounts/{account}/users/{email}` |\n\nIdentifiers\n-----------\n\nThe following table compares the identifiers used in requests between the\nContent API for Shopping and Merchant API.\n\n| Identifier description | Content API for Shopping | Merchant API |\n|------------------------|-------------------------------------------------|-----------------------------------------------|\n| Account identifier | `accountId` | `account` in `accounts/{account}` |\n| User identifier | `email_address` within the `AccountUser` object | `email` in `accounts/{account}/users/{email}` |\n\nMethods\n-------\n\nThe following table compares the methods between the Content API for Shopping\nand Merchant API.\n\n| Content API for Shopping | Merchant API | Availability \\& notes |\n|--------------------------|----------------------------------------------------------------------------------|------------------------------------|\n| `accounts.update` | [`users.create`](/merchant/api/reference/rest/accounts_v1/accounts.users/create) | Creates a new user for an account. |\n| `accounts.get` | [`users.get`](/merchant/api/reference/rest/accounts_v1/accounts.users/get) | Retrieves a single user. |\n| `accounts.get` | [`users.list`](/merchant/api/reference/rest/accounts_v1/accounts.users/list) | Lists all users for an account. |\n| `accounts.update` | [`users.update`](/merchant/api/reference/rest/accounts_v1/accounts.users/update) | Updates a user's access rights. |\n| `accounts.update` | [`users.delete`](/merchant/api/reference/rest/accounts_v1/accounts.users/delete) | Deletes a user from an account. |\n\nDetailed field changes\n----------------------\n\nUpdate your use of fields as follows:\n\n| Content API for Shopping | Merchant API | Description |\n|---------------------------------------------------------------------------------------------|-----------------------------------------------------|---------------------------------------------------------------------------------------------------------------|\n| `users` (repeated `AccountUser`) | `users` (repeated `User`) | The `User` resource is now a top-level resource with its own service. |\n| `AccountUser.email_address` | `CreateUserRequest.user_id` and part of `User.name` | The user's email address is now part of the resource name. Specify it in the `user_id` field during creation. |\n| `AccountUser.admin` | `access_rights: \"ADMIN\"` | Merchant API replaces the boolean `admin` field by the `ADMIN` value in the `access_rights` enum. |\n| `AccountUser.order_manager`, `AccountUser.payments_manager`, `AccountUser.payments_analyst` | `access_rights: \"STANDARD\"` | Merchant API replaces these roles to `STANDARD` access right. |\n| `AccountUser.reporting_manager` | `access_rights: \"PERFORMANCE_REPORTING\"` | The `reporting_manager` role is now the `PERFORMANCE_REPORTING` access right. |\n| `AccountUser.read_only` | `access_rights: \"READ_ONLY\"` | The `read_only` role is now the `READ_ONLY` access right. |\n| Not available | `User.name` | Contains the full resource name of the user, for example, `accounts/{account}/users/{email}`. |\n| Not available | `User.state` | Indicates the status of the user's invitation, either `PENDING` or `VERIFIED`. |"]]