Enterprises: getServiceAccount
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
แสดงบัญชีบริการและข้อมูลเข้าสู่ระบบ บัญชีบริการจะเชื่อมโยงกับองค์กรได้โดยเรียกใช้ setAccount บัญชีบริการจะสร้างขึ้นสำหรับองค์กรและ EMM นี้เท่านั้น และจะลบออกหากองค์กรไม่ได้เชื่อมโยง ข้อมูลเข้าสู่ระบบมีข้อมูลคีย์ส่วนตัวและจะไม่จัดเก็บไว้ฝั่งเซิร์ฟเวอร์
เมธอดนี้จะเรียกใช้ได้หลังจากเรียกใช้ Methods.Enroll หรือ Methods.CompleteSignup และก่อนเรียกใช้ Methods.SetAccount เท่านั้น ไม่เช่นนั้นระบบจะแสดงข้อผิดพลาด
การเรียกใช้ครั้งต่อๆ ไปหลังจากครั้งแรกจะสร้างชุดข้อมูลเข้าสู่ระบบใหม่ที่ไม่ซ้ำกันและทำให้ข้อมูลเข้าสู่ระบบที่สร้างขึ้นก่อนหน้านี้ใช้งานไม่ได้
เมื่อเชื่อมโยงบัญชีบริการกับองค์กรแล้ว คุณจะจัดการบัญชีบริการได้โดยใช้ทรัพยากร serviceAccountKeys
.
ส่งคำขอ
คำขอ HTTP
GET https://www.googleapis.com/androidenterprise/v1/enterprises/enterpriseId/serviceAccount
พารามิเตอร์
ชื่อพารามิเตอร์ |
ค่า |
คำอธิบาย |
พารามิเตอร์เส้นทาง |
enterpriseId |
string |
รหัสขององค์กร
|
พารามิเตอร์การค้นหาที่ไม่บังคับ |
keyType |
string |
ประเภทข้อมูลเข้าสู่ระบบที่จะแสดงพร้อมกับบัญชีบริการ ต้องระบุ
ค่าที่ยอมรับมีดังนี้
- "
googleCredentials "
- "
pkcs12 "
|
การให้สิทธิ์
คำขอนี้ต้องได้รับสิทธิ์ที่มีขอบเขตต่อไปนี้
ขอบเขต |
https://www.googleapis.com/auth/androidenterprise |
ดูข้อมูลเพิ่มเติมได้ที่หน้าการตรวจสอบสิทธิ์และการให้สิทธิ์
เนื้อหาของคำขอ
อย่าระบุเนื้อหาคำขอด้วยเมธอดนี้
การตอบกลับ
หากทำสำเร็จ วิธีการนี้จะแสดงผลลัพธ์เป็นเนื้อหาการตอบกลับซึ่งมีโครงสร้างดังต่อไปนี้
{
"kind": "androidenterprise#serviceAccount",
"name": string,
"key": serviceaccountkeys Resource
}
ชื่อพร็อพเพอร์ตี้ |
ค่า |
คำอธิบาย |
หมายเหตุ |
name |
string |
ชื่อบัญชีของบัญชีบริการในรูปแบบอีเมล กำหนดโดยเซิร์ฟเวอร์ |
|
key |
nested object |
ข้อมูลเข้าสู่ระบบที่ใช้ตรวจสอบสิทธิ์เป็นบัญชีบริการนี้ได้ |
|
kind |
string |
|
|
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-03-26 UTC
[null,null,["อัปเดตล่าสุด 2025-03-26 UTC"],[[["\u003cp\u003eGenerates a service account and credentials that are unique to the enterprise and EMM and can be used for authentication.\u003c/p\u003e\n"],["\u003cp\u003eThe service account can be bound to the enterprise using the \u003ccode\u003esetAccount\u003c/code\u003e call and managed with the \u003ccode\u003eserviceAccountKeys\u003c/code\u003e resource.\u003c/p\u003e\n"],["\u003cp\u003eRequires prior enrollment or signup completion and executing this method invalidates previously generated credentials, issuing new ones.\u003c/p\u003e\n"],["\u003cp\u003eOnly specific key types (\u003ccode\u003egoogleCredentials\u003c/code\u003e or \u003ccode\u003epkcs12\u003c/code\u003e) are supported when requesting the service account.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization with the \u003ccode\u003ehttps://www.googleapis.com/auth/androidenterprise\u003c/code\u003e scope is necessary for this request.\u003c/p\u003e\n"]]],[],null,["# Enterprises: getServiceAccount\n\n| **Note:** Requires [authorization](#auth).\n\nReturns a service account and credentials. The service account\ncan be bound to the enterprise by calling setAccount. The service account\nis unique to this enterprise and EMM, and will be deleted if the enterprise\nis unbound. The credentials contain private key data and are not stored\nserver-side.\n\n\u003cbr /\u003e\n\n\nThis method can only be called after calling\nEnterprises.Enroll or Enterprises.CompleteSignup, and before\nEnterprises.SetAccount; at other times it will return an error.\n\n\u003cbr /\u003e\n\n\nSubsequent calls after the first will generate a new, unique set of\ncredentials, and invalidate the previously generated credentials.\n\n\u003cbr /\u003e\n\n\nOnce the service account is bound to the enterprise, it can be managed\nusing the serviceAccountKeys resource.\n\n\u003cbr /\u003e\n\n\n\u003cbr /\u003e\n\n| **Note:** After you create a key, you might need to wait for 60 seconds or more before you perform another operation with the key. If you try to perform an operation with the key immediately after you create the key, and you receive an error, you can [retry\n| the request with exponential backoff](https://cloud.google.com/iam/docs/retry-strategy)\n\n\u003cbr /\u003e\n\n.\n\n\u003cbr /\u003e\n\nRequest\n-------\n\n### HTTP request\n\n```\nGET https://www.googleapis.com/androidenterprise/v1/enterprises/enterpriseId/serviceAccount\n```\n\n### Parameters\n\n| Parameter name | Value | Description |\n|----------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Path parameters** |||\n| `enterpriseId` | `string` | The ID of the enterprise. |\n| **Optional query parameters** |||\n| `keyType` | `string` | The type of credential to return with the service account. Required. \u003cbr /\u003e \u003cbr /\u003e Acceptable values are: - \"`googleCredentials`\" - \"`pkcs12`\" |\n\n### Authorization\n\nThis request requires authorization with the following scope:\n\n| Scope |\n|-----------------------------------------------------|\n| `https://www.googleapis.com/auth/androidenterprise` |\n\nFor more information, see the [authentication and authorization](/android/work/play/emm-api/v1/how-tos/authorizing) page.\n\n### Request body\n\nDo not supply a request body with this method.\n\nResponse\n--------\n\nIf successful, this method returns a response body with the following structure:\n\n```text\n{\n \"kind\": \"androidenterprise#serviceAccount\",\n \"name\": string,\n \"key\": serviceaccountkeys Resource\n}\n```\n\n| Property name | Value | Description | Notes |\n|---------------|-----------------|---------------------------------------------------------------------------------------------------|-------|\n| `name` | `string` | The account name of the service account, in the form of an email address. Assigned by the server. | |\n| `key` | `nested object` | Credentials that can be used to authenticate as this ServiceAccount. | |\n| `kind` | `string` | | |"]]