rocket
تعرَّف على
Merchant API
الذي يحلّ رسميًا محلّ Content API for Shopping.
add_alert
ملاحظة: سيتم إيقاف Content API for Shopping نهائيًا في 18 أغسطس 2026.
حسابات الخدمة
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
حسابات الخدمة هي حسابات Google خاصة يمكن استخدامها من قِبل التطبيقات للوصول إلى Google APIs آليًا من خلال بروتوكول OAuth 2.0. يستخدم حساب الخدمة
عملية OAuth 2.0 التي لا تتطلّب تفويضًا من أحد الأشخاص.
بدلاً من ذلك، يستخدم ملف مفتاح يمكن لتطبيقك فقط الوصول إليه. يتناول هذا الدليل
كيفية الوصول إلى Content API for Shopping باستخدام حسابات الخدمة.
ملاحظة: لا يمكن للتطبيقات التي تستخدم حسابات الخدمة
للمصادقة الوصول إلا إلى حسابك على Merchant Center. إذا كنت بصدد تطوير تطبيق تابع لجهة خارجية يحتاج إلى الوصول إلى حسابات Merchant Center الخاصة بعملاءك، يُرجى الاطّلاع على دليل الطلبات المُصرَّح بها بدلاً من ذلك.
المتطلبات الأساسية
خطوات استخدام حساب خدمة للوصول إلى Content API for Shopping
- أنشئ بيانات اعتماد حساب الخدمة أو يمكنك الوصول إلى بيانات الاعتماد العامة
التي سبق لك إنشاؤها. ستحتاج إلى إنشاء معرِّف عميل OAuth 2.0 والحصول على ملف مفتاح خاص *.json:
- انتقِل إلى وحدة التحكم في واجهة Google API.
- اختَر مشروعًا من القائمة المنسدلة في أعلى الصفحة. إذا
لم يكن لديك مشروع، أنشئ مشروعًا بالنقر على مشروع جديد.
- إذا لم يسبق لك تفعيل Content API for Shopping
لهذا المشروع، ابحث عنها في قائمة واجهات برمجة تطبيقات Google وفعِّلها.
- في الشريط الجانبي على يمين الصفحة، اختَر بيانات الاعتماد.
قد تحتاج إلى النقر على السهم المتّجه لليسار في أعلى يمين الصفحة للاطّلاع على هذا الخيار.
- لإعداد حساب خدمة، اختَر إنشاء بيانات اعتماد، ثم حساب الخدمة.
- حدِّد اسمًا
لحساب الخدمة الجديد. ويُستخدَم هذا الاسم أيضًا كاسم المستخدم التلقائي لملف تعريف
رقم تعريف حساب الخدمة. سجِّل رقم تعريف حساب الخدمة، بما في ذلك الجزء الذي يليه
الرمز "@"، لاستخدامه لاحقًا. انقر على إنشاء، ثم اتّبِع الخطوات
الاختيارية لمنح إذن الوصول إلى المشروع والمستخدمين، وانقر على تم.
لن يؤثر اختيار دور حساب الخدمة
في نوع الطلبات التي يمكن إجراؤها إلى Content API، إذ يتم تحديد إمكانية الوصول إلى
طرق Content API بدلاً من الدور المرتبط
برقم تعريف حساب الخدمة في Merchant Center. إذا لم تكن متأكدًا من الخيار الذي تريده، ما عليك سوى
اختيار المشروع > المُشاهد.
- سيتم توجيهك إلى صفحة "حسابات الخدمة" التي يمكن من خلالها الوصول إلى
حساب الخدمة الجديد.
- للحصول على مفتاح خاص بتنسيق JSON، انقر على حساب الخدمة، ثم على علامة التبويب
المفاتيح. انقر على إضافة مفتاح > إنشاء مفتاح جديد ثم اختَر JSON كنوع المفتاح. انقر على إنشاء لتنزيل المفتاح الخاص على
جهاز الكمبيوتر.
- أضِف حساب الخدمة الجديد
بصفته مستخدمًا إلى حسابك على Merchant Center. إذا كنت مطوّرًا تابعًا لجهة خارجية، عليك أن تطلب من عميلك تنفيذ هذه الخطوة نيابةً عنك.
- انتقِل إلى حسابك على Merchant
Center.
- انتقِل إلى الوصول إلى الحساب في إعدادات حسابك على
Merchant Center.
- انقر على + إضافة مستخدم واستخدِم رقم تعريف حساب الخدمة كعنوان البريد الإلكتروني
للمستخدم الجديد.
إذا لم تسجِّل رقم تعريف حساب الخدمة في وقت سابق، انتقِل إلى صفحة إدارة حسابات الخدمة واختَر المشروع الذي أنشأته.
- حدِّد الإعدادات المفضّلة لكلّ من وصول المستخدم والإشعارات عبر البريد الإلكتروني
لحساب الخدمة. يُرجى العِلم أنّ استخدام
Accounts
يتطلّب إذن وصول المشرف.
- انقر على إضافة مستخدم لحفظ الإعدادات المفضّلة والرجوع إلى قائمة
المستخدِمين. يجب إدراج معرّف حساب الخدمة مع دور المستخدم
الذي تم اختياره.
- كرِّر العملية لجميع حسابات الخدمة الأخرى التي تريد إضافتها.
- يمكنك الآن الوصول إلى حسابك على Merchant Center باستخدام حساب الخدمة
إما باستخدام عملية تطبيق Google
بيانات الاعتماد التلقائية أو باستخدام عملية حساب الخدمة
مباشرةً. توضِّح عيّنات Content API for Shopping كيفية استخدام كل من عمليتَي المصادقة لحساب الخدمة في كل لغة برمجة متوافقة.
يُرجى الاطّلاع على نماذج الرموز البرمجية لتجربة حساب الخدمة الجديد ومعرفة التغيُّرات التي ستحتاج إليها لاستخدام حسابات الخدمة في الرمز البرمجي الخاص بك.
الأسئلة الشائعة
- هل يمكنني تسجيل الدخول إلى واجهة مستخدم Merchant Center باستخدام حساب الخدمة؟
- لا، حسابات الخدمة ليست حسابات عادية على Google ولا يمكنها الوصول إلى واجهة مستخدم Merchant Center.
- ما هي الوتيرة التي يجب أن أُعيد فيها تحميل الرموز المميّزة لحساب الخدمة؟
- تنتهي صلاحية رموز الوصول بعد ساعة واحدة من إصدارها من قِبل "خادم مصادقة Google OAuth 2.0". عند انتهاء صلاحية رمز مميّز للوصول، يجب أن يستخدم التطبيق
مكتبة العميل لجلب رمز مميّز آخر للوصول.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eService accounts enable applications to programmatically access Google APIs, including the Content API for Shopping, using OAuth 2.0 without human intervention.\u003c/p\u003e\n"],["\u003cp\u003eTo utilize service accounts, you need to generate service account credentials, add the service account as a user in your Merchant Center account, and then access your Merchant Center account using either the Google Application Default Credentials flow or the service account flow.\u003c/p\u003e\n"],["\u003cp\u003eApplications authenticated with service accounts can only access your own Merchant Center account; for third-party applications needing access to client accounts, refer to the Authorizing Requests guide.\u003c/p\u003e\n"],["\u003cp\u003eService accounts cannot be used to sign in to the Merchant Center UI and access tokens expire after one hour, requiring the application to fetch a new one using the client library.\u003c/p\u003e\n"]]],["Service accounts allow applications to access the Content API for Shopping programmatically. Key actions include: generating service account credentials by creating an OAuth 2.0 Client ID and a JSON private key file via the Google API Console, and adding the service account as a user within the Merchant Center account, specifying access and notification preferences. To access the Merchant center, you can use Google Application Default Credentials or a service account flow, with example code available. Access tokens expire hourly, requiring renewal.\n"],null,["# Service accounts are special Google accounts that can be used by\napplications to access Google APIs programmatically via OAuth 2.0. A service\naccount uses an OAuth 2.0 flow that does not require human authorization.\nInstead, it uses a key file that only your application can access. This guide\ndiscusses how to access the Content API for Shopping with service accounts.\n\n**Note:** Applications using service accounts\nfor authentication can only access your own Merchant Center account. If you are\nwriting a third-party application that needs access to your clients' Merchant\nCenter accounts, please see the [Authorizing Requests](/shopping-content/guides/how-tos/authorizing)\nguide instead.\n\nPrerequisites\n-------------\n\n- A [Merchant Center](//merchants.google.com/) account.\n\nSteps to using a service account to access the Content API for Shopping\n-----------------------------------------------------------------------\n\n1. Generate service account credentials or access the public credentials you've already generated. You will need to create an OAuth 2.0 Client ID and obtain a \\*.json private key file:\n 1. Go to the [Google API Console](https://console.cloud.google.com/apis/library).\n 2. Select a project in the drop-down menu at the top of the page. If you do not have one yet, create one by clicking **NEW PROJECT**.\n 3. If you have not already enabled the Content API for Shopping for this project, then search for it in the list of Google APIs and enable it.\n 4. In the sidebar on the left, select **Credentials**. You may need to click the left-pointing arrow at the top left to see this.\n 5. To set up a service account, select **CREATE CREDENTIALS** , and then **Service account** . \n 6. Name the new service account. This also serves as the default username for the service account ID. Record the service account ID, including the part after the '@' character, for later use. Click **CREATE** , then go through the optional steps of granting access to project and users, and click **DONE** .\n\n The choice of role for the service account will not\n have any effect on what calls can be made to the Content API, as access to\n Content API methods is determined instead by the role associated with the\n service account ID in Merchant Center. If you are unsure what to pick, just\n pick **Project \\\u003e Viewer**.\n 7. You will be directed to the Service Accounts page where your new service account can be accessed.\n 8. To obtain a JSON private key, click on the service account, then the **KEYS** tab. Click **ADD KEY \\\u003e Create new key** and then select JSON as the key type. Click **CREATE** to download the private key to your computer.\n2. Add the new service account as a user to your Merchant Center account. If you are a third-party developer, you will need to have your client do this step for you.\n 1. Go to your [Merchant\n Center account](//merchants.google.com/).\n 2. Go to **Account Access** in the settings of your Merchant Center account.\n 3. Click **+ Add user** and use the service account ID as the email address for the new user.\n\n If you did not take note of the\n service account ID earlier, go to the [Service\n Accounts](//console.developers.google.com/iam-admin/serviceaccounts/) administration page and select the project you created.\n 4. Specify the **User access** and **Email notifications** preferences for the service account. Note that the use of the `Accounts` service requires **Admin** access.\n 5. Click **Add user** to save preferences and be returned to the list of users. The service account ID should be listed with the chosen user role.\n 6. Repeat the process for all other service accounts you want to add.\n3. Now you can access your Merchant Center account using the service account either by using the [Google Application\n Default Credentials](/identity/protocols/application-default-credentials) flow or by using the [service account flow](/identity/protocols/OAuth2ServiceAccount) directly. The Content API for Shopping [Samples](/shopping-content/guides/libraries) show how to use both flows for service account credentials in each supported programming language. Please check out the code samples to try out your new service account and to learn what changes you will need to use service accounts in your own code.\n\nFrequently asked questions\n--------------------------\n\nCan I sign in to the Merchant Center UI with my service account?\n: No, service accounts are not regular Google accounts and cannot access the\n Merchant Center UI.\n\nHow often do I need to refresh service account access tokens?\n: Access tokens expire one hour after they are issued by the Google OAuth 2.0\n Authorization Server. When an access token expires, the application should use\n the client library to fetch another access token."]]