rocket
Meet
Merchant API
- the official successor to Content API for Shopping.
update
עדכונים אחרונים
לגבי תכונות חדשות, תיקוני באגים וגרסאות חדשות של Merchant API
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.
- בוחרים פרויקט בתפריט הנפתח שבחלק העליון של הדף. אם עדיין אין לכם פרויקט, לוחצים על NEW PROJECT (פרויקט חדש).
- אם עדיין לא הפעלתם את Content API for Shopping בפרויקט הזה, חפשו אותו ברשימת ממשקי Google API והפעילו אותו.
- בסרגל הצד שמימין, בוחרים באפשרות פרטי כניסה.
כדי לראות את האפשרות הזו, יכול להיות שתצטרכו ללחוץ על החץ שמאלה בפינה הימנית העליונה.
- כדי להגדיר חשבון שירות, בוחרים באפשרות CREATE CREDENTIALS, ואז Service account.
- נותנים שם לחשבון השירות החדש. הוא משמש גם כשם המשתמש שמוגדר כברירת מחדל למזהה של חשבון השירות. שומרים את מזהה חשבון השירות, כולל החלק אחרי התו '@', לשימוש מאוחר יותר. לוחצים על CREATE ואז מבצעים את השלבים האופציונליים של הענקת גישה לפרויקט ולמשתמשים, ולוחצים על DONE.
בחירת התפקיד של חשבון השירות לא תשפיע על הקריאות שניתן לבצע ל-Content API, כי הגישה לשיטות של Content API נקבעת לפי התפקיד שמשויך למזהה חשבון השירות ב-Merchant Center. אם אתם לא בטוחים מה לבחור, תוכלו פשוט לבחור באפשרות Project > Viewer.
- תועברו לדף Service Accounts, שבו תוכלו לגשת לחשבון השירות החדש.
- כדי לקבל מפתח פרטי מסוג JSON, לוחצים על חשבון השירות ואז על הכרטיסייה KEYS. לוחצים על ADD KEY (הוספת מפתח) > Create new key (יצירת מפתח חדש) ובוחרים באפשרות JSON בתור סוג המפתח. לוחצים על CREATE כדי להוריד את המפתח הפרטי למחשב.
- מוסיפים את חשבון השירות החדש כמשתמש לחשבון Merchant Center. אם אתם מפתחים של צד שלישי, תצטרכו לבקש מהלקוח לבצע את השלב הזה בשבילכם.
- עוברים אל חשבון Merchant Center.
- עוברים אל גישה לחשבון בהגדרות של חשבון Merchant Center.
- לוחצים על + הוספת משתמש ומשתמשים במזהה של חשבון השירות ככתובת האימייל של המשתמש החדש.
אם לא רשמתם את מזהה חשבון השירות מקודם, עוברים לדף הניהול Service accounts ובוחרים את הפרויקט שיצרתם.
- מציינים את ההעדפות של גישת משתמשים והתראות באימייל לחשבון השירות. שימו לב שהשימוש בשירות
Accounts
מחייב הרשאת אדמין.
- לוחצים על הוספת משתמש כדי לשמור את ההעדפות ולחזור לרשימת המשתמשים. מזהה חשבון השירות צריך להופיע עם תפקיד המשתמש שנבחר.
- חוזרים על התהליך לכל חשבונות השירות האחרים שרוצים להוסיף.
- עכשיו תוכלו לגשת לחשבון Merchant Center באמצעות חשבון השירות, באמצעות התהליך Google Application Default Credentials או ישירות באמצעות התהליך של חשבון השירות. בדוגמאות ל-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 (שעון UTC).
[null,null,["עדכון אחרון: 2025-08-29 (שעון UTC)."],[[["\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."]]