rocket
मिलें
Merchant API
से. यह Content API for Shopping की जगह लेने वाला आधिकारिक एपीआई है.
update
Merchant API की नई सुविधाओं, गड़बड़ियों को ठीक करने के तरीके, और अपडेट के बारे में
अपडेट पाएं.
add_alert
ध्यान दें: Content API for Shopping, 18 अगस्त, 2026 को बंद हो जाएगा.
सेवा वाले खाते
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
सेवा खाते, Google के खास खाते होते हैं. इनका इस्तेमाल, ऐप्लिकेशन के लिए OAuth 2.0 की मदद से, प्रोग्राम के तौर पर Google API को ऐक्सेस करने के लिए किया जा सकता है. सेवा खाता, OAuth 2.0 फ़्लो का इस्तेमाल करता है. इसके लिए, किसी व्यक्ति की अनुमति की ज़रूरत नहीं होती.
इसके बजाय, यह एक ऐसी कुंजी फ़ाइल का इस्तेमाल करता है जिसे सिर्फ़ आपका ऐप्लिकेशन ऐक्सेस कर सकता है. इस गाइड में, सेवा खातों की मदद से Content API for Shopping को ऐक्सेस करने का तरीका बताया गया है.
ध्यान दें: पुष्टि करने के लिए सेवा खातों का इस्तेमाल करने वाले ऐप्लिकेशन, सिर्फ़ आपके Merchant Center खाते को ऐक्सेस कर सकते हैं. अगर आपने तीसरे पक्ष का ऐसा ऐप्लिकेशन लिखा है जिसे आपके क्लाइंट के Merchant Center खातों का ऐक्सेस चाहिए, तो कृपया अनुरोधों को अनुमति देने से जुड़ी गाइड देखें.
ज़रूरी शर्तें
Shopping के लिए Content API को ऐक्सेस करने के लिए, सेवा खाते का इस्तेमाल करने का तरीका
- सेवा खाते के क्रेडेंशियल जनरेट करें या पहले से जनरेट किए गए सार्वजनिक क्रेडेंशियल ऐक्सेस करें. आपको OAuth 2.0 क्लाइंट आईडी बनाना होगा और *.json निजी कुंजी फ़ाइल पाना होगी:
- Google के एपीआई कंसोल पर जाएं.
- पेज पर सबसे ऊपर मौजूद ड्रॉप-डाउन मेन्यू में, कोई प्रोजेक्ट चुनें. अगर आपके पास अब तक कोई प्रोजेक्ट नहीं है, तो नया प्रोजेक्ट पर क्लिक करके एक प्रोजेक्ट बनाएं.
- अगर आपने इस प्रोजेक्ट के लिए, Content API for Shopping को पहले से चालू नहीं किया है, तो
Google API की सूची में उसे खोजें और चालू करें.
- बाईं ओर मौजूद साइडबार में, क्रेडेंशियल को चुनें.
इसे देखने के लिए, आपको सबसे ऊपर बाईं ओर मौजूद, बाईं ओर की ओर वाले ऐरो पर क्लिक करना पड़ सकता है.
- सेवा खाता सेट अप करने के लिए, क्रेडेंशियल बनाएं चुनें. इसके बाद, सेवा खाता चुनें.
- नए सेवा खाते को नाम दें. यह सेवा खाते के आईडी के लिए डिफ़ॉल्ट उपयोगकर्ता नाम के तौर पर भी काम करता है. सेवा खाते का आईडी रिकॉर्ड करें. इसमें '@' के बाद का हिस्सा भी शामिल करें, ताकि बाद में इसका इस्तेमाल किया जा सके. बनाएं पर क्लिक करें. इसके बाद, प्रोजेक्ट और उपयोगकर्ताओं को ऐक्सेस देने के लिए, वैकल्पिक चरणों को पूरा करें और हो गया पर क्लिक करें.
सेवा खाते के लिए भूमिका चुनने से, 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 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 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."]]