با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
در اینجا نحوه استفاده از CSS API آورده شده است:
مجوزها
برای کار با CSS API، باید مجوزها را در دو مکان پیکربندی کنید: Google Cloud و CSS Center.
Google Cloud IAM:
یک حساب سرویس در Google Cloud Console ایجاد کنید. دستورالعملهای مشابه Content API را برای ایجاد و دانلود فایل اعتبار JSON دنبال کنید. این مرحله حساب سرویس شما را به عنوان یک موجودیت معتبر Google Cloud احراز هویت می کند.
اگر از دسترسی مستقیم REST یا کتابخانه های Google API Client استفاده می کنید، همچنین به یک کلید API تولید شده از Google Cloud Console نیاز دارید.
مرکز CSS:
آدرس ایمیل حساب سرویس (به عنوان مثال، your-service-account-name@your-project-id.iam.gserviceaccount.com ) باید به عنوان کاربری با دسترسی Admin به حساب CSS Center شما اضافه شود. این مرحله به حساب سرویس اجازه دسترسی و مدیریت داده های مرکز CSS شما را می دهد.
میتوانید در سطح CSS Group (برای دسترسی به همه دامنهها) یا به حسابهای خاص دامنه CSS اجازه دسترسی بدهید. برای دسترسی API، اعطای دسترسی در سطح CSS Group رایج است.
برای افزودن حساب سرویس:
با یک کاربر سرپرست وارد CSS Center شوید.
به دسترسی به حساب (در زیر نماد چرخ دنده ⚙️) بروید.
روی + افزودن کاربر کلیک کنید و ایمیل حساب سرویس را وارد کنید.
سطح دسترسی را روی Admin تنظیم کنید.
انتشار مجوزها ممکن است تا 30 دقیقه طول بکشد. اگر با خطاهای مجوز مواجه شدید، بعداً دوباره امتحان کنید.
محدوده احراز هویت:
محدوده مورد نیاز OAuth 2.0 برای CSS API عبارت است از:
https://www.googleapis.com/auth/content
بررسی کنید که برنامه شما این محدوده را هنگام احراز هویت درخواست می کند.
تاریخ آخرین بهروزرسانی 2025-08-13 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-08-13 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eTo use the CSS API, create a service account with Admin access, enable the API in your Google Cloud project, and start programming using provided samples and libraries.\u003c/p\u003e\n"],["\u003cp\u003eSend requests to the CSS API using the specified URL format, replacing placeholders with relevant resource names and methods.\u003c/p\u003e\n"],["\u003cp\u003eThe CSS API supports both gRPC (recommended) and REST for making calls, with gRPC being the default for client libraries.\u003c/p\u003e\n"],["\u003cp\u003eFor support or to report issues, contact your Google representative or utilize the provided feedback channels for API features, documentation, or samples.\u003c/p\u003e\n"],["\u003cp\u003eSubmit feedback through designated forms or buttons for API features, documentation, samples and libraries or general feedback after task implementation.\u003c/p\u003e\n"]]],[],null,["# Get started with the CSS API\n\nHere's how to use the CSS API:\n\nPermissions\n-----------\n\nTo work with the CSS API, you need to configure permissions in two places:\nGoogle Cloud and CSS Center.\n\n1. **Google Cloud IAM:**\n\n - Create a service account in the [Google Cloud\n Console](https://console.cloud.google.com/apis/library). Follow similar [instructions as for the Content\n API](https://developers.google.com/shopping-content/guides/how-tos/service-accounts) to create and download the JSON credentials file. This step authenticates your service account as a valid Google Cloud entity.\n - If you're using direct REST access or the Google API Client libraries, you also need an [API\n Key](https://cloud.google.com/docs/authentication/api-keys) generated from the Google Cloud Console.\n2. **CSS Center:**\n\n - The service account email address (e.g., `your-service-account-name@your-project-id.iam.gserviceaccount.com`) must be added as a user with **Admin access** to your CSS Center account. This step authorizes the service account to access and manage your CSS Center data.\n - You can grant access at the CSS Group level (for access to all domains) or to specific CSS Domain accounts. For API access, granting access at the CSS Group level is common.\n - To add the service account:\n - Sign in to CSS Center with an administrator user.\n - Navigate to **Account access** (under the gear icon ⚙️).\n - Click **+ Add user** and enter the service account email.\n - Set the access level to **Admin**.\n - Permissions may take up to 30 minutes to propagate. If you encounter permission errors, try again later.\n\n**Authentication Scope:**\n\nThe required OAuth 2.0 scope for the CSS API is:\n\n- `https://www.googleapis.com/auth/content`\n\nVerify that your application requests this scope when authenticating.\n\nEnable the CSS API\n------------------\n\nIn order to use the CSS API, you need to enable it in your Google Cloud project.\nYou can find the library at\n\u003chttps://console.cloud.google.com/apis/library/css.googleapis.com\u003e.\n\nStart programming\n-----------------\n\nThe CSS API has [code samples](/comparison-shopping-services/api/code-samples),\nand [client libraries](/comparison-shopping-services/api/client-libraries) to\nhelp you get started. We also have a\n[best practices](/comparison-shopping-services/api/guides/best_practices) page.\n\nSend requests\n-------------\n\nSend requests to URLs in the following format: \n\n https://css.googleapis.com/\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-p\"\u003e{\u003c/span\u003eversion\u003cspan class=\"devsite-syntax-p\"\u003e}\u003c/span\u003e\u003c/var\u003e/\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-p\"\u003e{\u003c/span\u003eresource name\u003cspan class=\"devsite-syntax-p\"\u003e}\u003c/span\u003e\u003c/var\u003e:\u003cvar translate=\"no\"\u003e{method\u003cspan class=\"devsite-syntax-p\"\u003e}\u003c/span\u003e\u003c/var\u003e...\n\nWhere \u003cvar translate=\"no\"\u003e{resource name}\u003c/var\u003e is the name of the resource\nyour call impacts.\n\nFor example, here's how to delete a resource with gRPC: \n\n https://css.googleapis.com/v1/\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-p\"\u003e{\u003c/span\u003eresource name\u003cspan class=\"devsite-syntax-p\"\u003e}\u003c/span\u003e\u003c/var\u003e:delete\n\nHere's how to delete a resource with REST: \n\n DELETE https://css.googleapis.com/v1/\u003cvar translate=\"no\"\u003e{resource name}\u003c/var\u003e\n\nSee the CSS API\n[reference documentation](/comparison-shopping-services/api/reference/rpc)\nfor more details on specific services.\n\nUse gRPC or REST\n----------------\n\nThe CSS API supports [gRPC](//grpc.io/docs/guides/) and\n[REST](//en.wikipedia.org/wiki/Representational_state_transfer). Here are the\ntwo ways to make CSS API calls:\n\n| gRPC (recommended) | REST |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1. Create the body of the request as a protocol buffer. 2. Send the request body to the server with HTTP/2. 3. Deserialize the response to a protocol buffer. 4. Interpret the results. | 1. Create the body of request as a JSON object. 2. Send it to the server using HTTP 1.1. 3. Deserialize the response as a JSON object. 4. Interpret the results. |\n\n| **Note:** If you use a client library, the default transport mechanism is gRPC. In most cases you don't need to do anything other than call the CSS API endpoints to use gRPC.\n\nGet help\n--------\n\nContact your Google representative for support, or use the [feedback\nform](https://support.google.com/css-center/gethelp) to report any issues.\n\nHere's how you can provide more feedback if you experience issues:\n\nGive feedback\n-------------\n\nTo provide feedback, submit one of the following:\n\n- **API features:** Submit the [feedback\n form](https://support.google.com/css-center/gethelp)\n- **Documentation:** Use the in-page thumb ratings and **Send feedback** button.\n- **Samples and libraries:** Use the **New issue** button on GitHub.\n\nTo provide general feedback after implementing each task, use the [feedback\nform](https://support.google.com/css-center/gethelp)."]]