রিসেলারদের জন্য .NET কুইকস্টার্ট
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
এই কুইকস্টার্ট গাইডের ধাপগুলি অনুসরণ করুন এবং প্রায় 10 মিনিটের মধ্যে আপনার কাছে একটি সাধারণ .NET C# কনসোল অ্যাপ থাকবে যা জিরো-টাচ এনরোলমেন্ট রিসেলার এপিআইকে অনুরোধ করে।
পূর্বশর্ত
এই কুইকস্টার্ট চালানোর জন্য আপনার প্রয়োজন হবে:
- একটি Google অ্যাকাউন্ট, এটি আপনার জিরো-টাচ এনরোলমেন্ট রিসেলার অ্যাকাউন্টের সদস্য। আপনি যদি এখনও অনবোর্ড না করে থাকেন, তাহলে রিসেলার পোর্টাল গাইডে শুরু করুন এর ধাপগুলি অনুসরণ করুন৷
- ভিজ্যুয়াল স্টুডিও 2013 বা তার পরে।
- ইন্টারনেট এবং একটি ওয়েব ব্রাউজারে অ্যাক্সেস।
ধাপ 1: জিরো-টাচ এনরোলমেন্ট API চালু করুন
- Google বিকাশকারী কনসোলে একটি প্রকল্প তৈরি বা নির্বাচন করতে এবং স্বয়ংক্রিয়ভাবে API চালু করতে এই উইজার্ডটি ব্যবহার করুন৷ Continue-এ ক্লিক করুন, তারপর শংসাপত্রে যান ।
- সেট আপনি কি ডেটা অ্যাক্সেস করা হবে? অ্যাপ্লিকেশন ডেটাতে ।
- পরবর্তী ক্লিক করুন. আপনাকে একটি পরিষেবা অ্যাকাউন্ট তৈরি করতে বলা উচিত।
- পরিষেবা অ্যাকাউন্ট নামের জন্য একটি বর্ণনামূলক নাম দিন।
- পরিষেবা অ্যাকাউন্ট আইডি নোট করুন (এটি একটি ইমেল ঠিকানার মতো দেখাচ্ছে) কারণ আপনি এটি পরে ব্যবহার করবেন৷
- পরিষেবা অ্যাকাউন্টে ভূমিকা সেট করুন > পরিষেবা অ্যাকাউন্ট ব্যবহারকারী ।
- পরিষেবা অ্যাকাউন্ট তৈরি করা শেষ করতে সম্পন্ন ক্লিক করুন।
- আপনার তৈরি করা পরিষেবা অ্যাকাউন্টের ইমেল ঠিকানাটিতে ক্লিক করুন।
- **কী** এ ক্লিক করুন।
- **কী যোগ করুন** ক্লিক করুন, তারপর **নতুন কী তৈরি করুন** এ ক্লিক করুন।
- **কী প্রকার** এর জন্য, **JSON** নির্বাচন করুন।
- তৈরি করুন এবং আপনার কম্পিউটারে ব্যক্তিগত কী ডাউনলোড ক্লিক করুন।
- **ক্লোজ** এ ক্লিক করুন।
- ফাইলটিকে আপনার ওয়ার্কিং ডাইরেক্টরিতে নিয়ে যান এবং এর নাম পরিবর্তন করুন
service_account_key.json
।
ধাপ 2: পরিষেবা অ্যাকাউন্ট লিঙ্ক করুন
- জিরো-টাচ এনরোলমেন্ট পোর্টাল খুলুন। আপনাকে সাইন ইন করতে হতে পারে।
- settings_ethernet পরিষেবা অ্যাকাউন্টে ক্লিক করুন।
- লিঙ্ক পরিষেবা অ্যাকাউন্ট add ক্লিক করুন.
- আপনার তৈরি পরিষেবা অ্যাকাউন্টের ঠিকানায় ইমেল ঠিকানা সেট করুন।
- আপনার জিরো-টাচ এনরোলমেন্ট অ্যাকাউন্টের সাথে পরিষেবা অ্যাকাউন্ট ব্যবহার করতে পরিষেবা অ্যাকাউন্ট লিঙ্ক করুন- এ ক্লিক করুন।
ধাপ 3: প্রকল্প প্রস্তুত করুন
- ভিজ্যুয়াল স্টুডিওতে একটি নতুন .NET কোর সি# কনসোল অ্যাপ্লিকেশন প্রকল্প তৈরি করুন।
- প্যাকেজ ম্যানেজার খুলুন, প্যাকেজ সোর্স nuget.org নির্বাচন করুন এবং নিম্নলিখিত প্যাকেজগুলি যোগ করুন:
-
Google.Apis.AndroidProvisioningPartner.v1
-
Google.Apis.Auth
আরও জানতে, মাইক্রোসফ্ট নথিটি পড়ুন ইনস্টল করুন এবং একটি প্যাকেজ ব্যবহার করুন ।
ধাপ 4: নমুনা সেট আপ করুন
- আপনার ভিজ্যুয়াল স্টুডিও সলিউশন এক্সপ্লোরারে
service_account_key.json
(ধাপ 1 এ ডাউনলোড করা হয়েছে) টেনে আনুন। -
service_account_key.json
নির্বাচন করুন, এবং তারপরে বৈশিষ্ট্য উইন্ডোতে যান এবং কপি টু আউটপুট ডিরেক্টরি ক্ষেত্রে সর্বদা অনুলিপি সেট করুন। - নিম্নলিখিত কোড দিয়ে
Program.cs
এর বিষয়বস্তু প্রতিস্থাপন করুন। -
PartnerId
(অ্যাপের প্রথম লাইন) এর মান হিসাবে আপনার নিজের রিসেলার পার্টনার আইডি ঢোকান।
using Google.Apis.AndroidProvisioningPartner.v1;
using Google.Apis.AndroidProvisioningPartner.v1.Data;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Services;
using System;
using System.Collections.Generic;
using System.IO;
namespace ZeroTouchResellerQuickstart
{
class Program
{
// TODO: replace this with your partner reseller ID.
static long PartnerId = 11036885;
// Use a single scope for the all methods in the reseller API.
static readonly string[] Scopes =
{ "https://www.googleapis.com/auth/androidworkprovisioning" };
static string ApplicationName = "Zero-touch Reseller .NET Quickstart";
static void Main(string[] args)
{
// Create a credential to authorize API requests using a service account key.
// The service account must be linked using the zero-touch portal.
ServiceAccountCredential credential;
using (var stream =
new FileStream("service_account_key.json", FileMode.Open, FileAccess.Read))
{
credential = GoogleCredential.FromStream(stream)
.CreateScoped(Scopes)
.UnderlyingCredential as ServiceAccountCredential;
}
// Create a zero-touch enrollment API service endpoint.
var service = new AndroidProvisioningPartnerService(new BaseClientService.Initializer
{
HttpClientInitializer = credential,
ApplicationName = ApplicationName
});
// Send an API request to list all our customers.
PartnersResource.CustomersResource.ListRequest request =
service.Partners.Customers.List(PartnerId);
ListCustomersResponse response = request.Execute();
// Print out the details of each customer.
IList<Company> customers = response.Customers;
if (customers != null)
{
foreach (Company customer in customers)
{
Console.WriteLine("Name:{0} ID:{1}",
customer.CompanyName,
customer.CompanyId);
}
}
else
{
Console.WriteLine("No customers found");
}
}
}
}
পার্টনার আইডি
এপিআই কলের জন্য সাধারণত আপনার রিসেলার পার্টনার আইডি একটি যুক্তি হিসাবে প্রয়োজন। জিরো-টাচ এনরোলমেন্ট পোর্টাল থেকে আপনার পার্টনার আইডি খুঁজে পেতে, নিচের ধাপগুলি অনুসরণ করুন:
- পোর্টাল খুলুন। আপনাকে সাইন ইন করতে হতে পারে।
- settings_ethernet পরিষেবা অ্যাকাউন্টে ক্লিক করুন।
- আপনার রিসেলার আইডি লাইন থেকে আপনার অংশীদার আইডি নম্বর কপি করুন।
ধাপ 5: নমুনা চালান
নমুনা তৈরি এবং চালাতে, ভিজ্যুয়াল স্টুডিও টুলবারে play_arrow Start-এ ক্লিক করুন।
সমস্যা সমাধান
কুইকস্টার্টে কী ভুল হয়েছে তা আমাদের বলুন এবং আমরা এটি ঠিক করার জন্য কাজ করব। এপিআই কল অনুমোদন করতে জিরো-টাচ কীভাবে পরিষেবা অ্যাকাউন্ট ব্যবহার করে তা জানতে, অনুমোদন পড়ুন।
আরও জানুন
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-08-29 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-08-29 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eThis quickstart guide helps you set up a .NET C# console application to interact with the zero-touch enrollment reseller API in approximately 10 minutes.\u003c/p\u003e\n"],["\u003cp\u003eYou'll need a Google account associated with your zero-touch enrollment reseller account, Visual Studio 2013 or later, and internet access to get started.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves enabling the zero-touch enrollment API, creating and linking a service account, setting up a .NET project, and configuring the sample code with your reseller partner ID.\u003c/p\u003e\n"],["\u003cp\u003eA service account is created and linked in order to authorize API requests; service account keys must be carefully managed to maintain security.\u003c/p\u003e\n"],["\u003cp\u003eThe guide provides steps to build and run a sample application that lists your customers using the zero-touch enrollment reseller API.\u003c/p\u003e\n"]]],["This guide outlines creating a .NET C# console app to interact with the zero-touch enrollment reseller API. Key steps include: enabling the API via the Google Developers Console, creating and downloading a JSON service account key, and linking the service account in the zero-touch enrollment portal. Next, it requires creating a new .NET Core console application, adding necessary NuGet packages, and copying the service account key to the project. Finally, replace the code with the provided sample code including the partner ID, and then run the app.\n"],null,["# .NET quickstart for resellers\n\nFollow the steps in this quickstart guide, and in about 10 minutes you'll have\na simple .NET C# console app that makes requests to the zero-touch enrollment\nreseller API.\n\nPrerequisites\n-------------\n\nTo run this quickstart, you'll need:\n\n- A Google account, that's a member of your zero-touch enrollment reseller account. If you haven't onboarded yet, follow the steps in *Get started* in the [Reseller portal guide](/zero-touch/guides/portal).\n- Visual Studio 2013 or later.\n- Access to the internet and a web browser.\n\nStep 1: Turn on the zero-touch enrollment API\n---------------------------------------------\n\n1. Use [this\n wizard](https://console.developers.google.com/start/api?id=androiddeviceprovisioning.googleapis.com) to create or select a project in the Google Developers Console and automatically turn on the API. Click **Continue** , then **Go to credentials**.\n2. Set **What data will you be accessing?** to *Application data*.\n3. Click **Next**. You should be prompted to create a service account.\n4. Give a descriptive name for **Service account name**.\n5. Note the **Service account ID** (it looks like an email address) because you'll use it later.\n6. Set **Role** to *Service Accounts \\\u003e Service Account User*.\n7. Click **Done** to finish creating the service account.\n8. Click the email address for the service account that you created.\n9. Click \\*\\*Keys\\*\\*.\n10. Click \\*\\*Add key\\*\\*, then click \\*\\*Create new key\\*\\*.\n11. For \\*\\*Key type\\*\\*, select \\*\\*JSON\\*\\*.\n12. Click **Create** and the private key downloads to your computer.\n13. Click \\*\\*Close\\*\\*.\n14. Move the file to your working directory and rename it `service_account_key.json`.\n\n| **Warning:** Service account keys can become a security risk if not managed carefully. For advice see [best practices for managing API keys](https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys).\n\nStep 2: Link the service account\n--------------------------------\n\n1. Open the zero-touch enrollment [portal](https://enterprise.google.com/android/zero-touch/resellers). You might need to sign in.\n2. Click settings_ethernet **Service\n accounts**.\n3. Click add **Link service account**.\n4. Set **Email address** to the address of the service account you created.\n5. Click **Link service account** to use the service account with your zero-touch enrollment account.\n\nStep 3: Prepare the project\n---------------------------\n\n1. Create a new .NET Core C# *Console Application* project in Visual Studio.\n2. Open the Package Manager, select the package source **nuget.org** , and add the following packages:\n - `Google.Apis.AndroidProvisioningPartner.v1`\n - `Google.Apis.Auth`\n\nTo learn more, read the Microsoft document [Install and use a\npackage](https://docs.microsoft.com/en-us/nuget/quickstart/use-a-package).\n\nStep 4: Set up the sample\n-------------------------\n\n1. Drag `service_account_key.json` (downloaded in Step 1) into your Visual Studio Solution Explorer.\n2. Select `service_account_key.json`, and then go to the Properties window and set **Copy to output directory** field to *Always copy*.\n3. Replace the contents of `Program.cs` with the following code.\n4. Insert your own [reseller partner ID](#partner-id) as the value for `PartnerId` (the app's first line).\n\n```c#\nusing Google.Apis.AndroidProvisioningPartner.v1;\nusing Google.Apis.AndroidProvisioningPartner.v1.Data;\nusing Google.Apis.Auth.OAuth2;\nusing Google.Apis.Services;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace ZeroTouchResellerQuickstart\n{\n class Program\n {\n // TODO: replace this with your partner reseller ID.\n static long PartnerId = 11036885;\n\n // Use a single scope for the all methods in the reseller API.\n static readonly string[] Scopes =\n { \"https://www.googleapis.com/auth/androidworkprovisioning\" };\n static string ApplicationName = \"Zero-touch Reseller .NET Quickstart\";\n\n static void Main(string[] args)\n {\n // Create a credential to authorize API requests using a service account key.\n // The service account must be linked using the zero-touch portal.\n ServiceAccountCredential credential;\n using (var stream =\n new FileStream(\"service_account_key.json\", FileMode.Open, FileAccess.Read))\n {\n credential = GoogleCredential.FromStream(stream)\n .CreateScoped(Scopes)\n .UnderlyingCredential as ServiceAccountCredential;\n }\n\n // Create a zero-touch enrollment API service endpoint.\n var service = new AndroidProvisioningPartnerService(new BaseClientService.Initializer\n {\n HttpClientInitializer = credential,\n ApplicationName = ApplicationName\n });\n\n // Send an API request to list all our customers.\n PartnersResource.CustomersResource.ListRequest request =\n service.Partners.Customers.List(PartnerId);\n ListCustomersResponse response = request.Execute();\n\n // Print out the details of each customer.\n IList\u003cCompany\u003e customers = response.Customers;\n if (customers != null)\n {\n foreach (Company customer in customers)\n {\n Console.WriteLine(\"Name:{0} ID:{1}\",\n customer.CompanyName,\n customer.CompanyId);\n }\n }\n else\n {\n Console.WriteLine(\"No customers found\");\n }\n }\n }\n}\n```\n\n### Partner ID\n\nAPI calls typically need your reseller partner ID as an argument. To find your\npartner ID from the zero-touch enrollment portal, follow the steps below:\n\n1. Open the [portal](https://enterprise.google.com/android/zero-touch/resellers). You might need to sign in.\n2. Click settings_ethernet **Service\n accounts**.\n3. Copy your partner ID number from the **Your reseller ID** line.\n\nStep 5: Run the sample\n----------------------\n\nTo build and run the sample, click play_arrow **Start** in the Visual Studio toolbar.\n\nTroubleshooting\n---------------\n\n\n[Tell us what went wrong]() with the quickstart and we'll work to\nfix it. To learn how zero-touch uses service accounts to authorize API calls, read\n[Authorization](/zero-touch/guides/auth).\n\nLearn more\n----------\n\n- [Google Developers Console help documentation](/console/help/new)\n- [Google API Client Library for .NET\n documentation](/api-client-library/dotnet)\n- [Using OAuth 2.0 for Server to Server\n Applications](/identity/protocols/OAuth2ServiceAccount)"]]