ข้อมูลเมตาของอุปกรณ์
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ในฐานะที่เป็นตัวแทนจำหน่าย คุณสามารถเชื่อมโยงข้อมูลเมตา เช่น หมายเลขโทรศัพท์ หรือ
หมายเลขใบสั่งซื้อของอุปกรณ์แต่ละเครื่อง คุณสามารถเชื่อมโยงข้อมูลเมตาได้ด้วยการเรียก
API หรือการอัปโหลดไฟล์ CSV
ในพอร์ทัลการตั้งค่าอุปกรณ์พร้อมใช้แบบรวมกลุ่ม ตาราง 1 แสดงผู้ที่มีสิทธิ์เชื่อมโยงและดูข้อมูลเมตา
ตาราง 1 สิทธิ์สำหรับข้อมูลเมตา
งาน |
ตัวแทนจำหน่าย |
ลูกค้า |
เชื่อมโยงข้อมูลเมตาโดยเรียกใช้ API |
|
|
เชื่อมโยงข้อมูลเมตาโดยอัปโหลดไฟล์ CSV ไปยังพอร์ทัลการตั้งค่าอุปกรณ์พร้อมใช้แบบรวมกลุ่ม |
|
|
ดูข้อมูลเมตาของอุปกรณ์ในผลการเรียก API |
|
|
ดูข้อมูลเมตาของอุปกรณ์ในพอร์ทัลการตั้งค่าอุปกรณ์พร้อมใช้แบบรวมกลุ่ม |
|
|
ในการเชื่อมโยงข้อมูลเมตากับอุปกรณ์แต่ละเครื่อง ให้เรียกเมธอด
partners.devices.metadata
คุณสามารถเพิ่ม
หมายเลขโทรศัพท์และหมายเลขคำสั่งซื้อสำหรับอุปกรณ์ Android ของคุณโดยใช้คีย์จากตาราง 2
ด้านล่าง
ตาราง 2 คีย์ข้อมูลเมตาสำหรับอุปกรณ์ Android
ข้อมูล |
คีย์ |
ประเภทค่า |
ตัวอย่าง |
หมายเลขโทรศัพท์ |
phonenumber |
สตริง |
+66 800 555-0100 |
หมายเลขคำสั่งซื้อ |
ordernumber |
สตริง |
GOOG#123/ABC-123456 |
ค่าข้อมูลเมตาทั้งสองเป็นสตริงรูปแบบอิสระ ดังนั้นคุณจึงสามารถใช้รูปแบบที่ทำให้
ในองค์กร
สำหรับอุปกรณ์ ChromeOS คุณใช้คีย์จากตารางที่ 3 ด้านล่างได้
ตาราง 3 คีย์ข้อมูลเมตาสำหรับอุปกรณ์ ChromeOS
ข้อมูล |
คีย์ |
ประเภทค่า |
ตัวอย่าง |
หมายเลขคำสั่งซื้อ |
ordernumber |
สตริง |
GOOG#123/ABC-123456 |
หากต้องการกำหนดข้อมูลเมตาขณะที่คุณสร้างอุปกรณ์ ให้ใส่ข้อมูลเมตาเมื่อเรียกใช้
claimAsync
ตัวอย่างด้านล่างแสดงการตั้งค่า
หมายเลขโทรศัพท์และหมายเลขคำสั่งซื้อสำหรับอุปกรณ์ที่มีอยู่ TARGET_DEVICE_ID
:
Java
// Allowed metadata dictionary keys.
private static String METADATA_KEY_PHONE_NUMBER = "phonenumber";
private static String METADATA_KEY_ORDER_NUMBER = "ordernumber";
// ...
// Create the metadata record with the values.
DeviceMetadata metadata = new DeviceMetadata();
Map<String,String> entries = new HashMap<String, String>();
entries.put(METADATA_KEY_ORDER_NUMBER, "GOOG123/ABC-#123456");
entries.put(METADATA_KEY_PHONE_NUMBER, "+1 (800) 555-0100");
metadata.setEntries(entries);
// Set the metadata values on the target device.
UpdateDeviceMetadataRequest body = new UpdateDeviceMetadataRequest();
body.setDeviceMetadata(metadata);
DeviceMetadata response = service
.partners()
.devices()
.metadata(PARTNER_ID, targetDeviceId, body)
.execute();
.NET
// Allowed metadata dictionary keys.
private static string MetadataKeyPhoneNumber = "phonenumber";
private static string MetadataKeyOrderNumber = "ordernumber";
// ...
// Create the metadata record with the values.
DeviceMetadata metadata = new DeviceMetadata
{
Entries = new Dictionary<string, string> {
{MetadataKeyOrderNumber, "GOOG123/ABC-#123456"},
{MetadataKeyPhoneNumber, "+1 (800) 555-0100"}
}
};
// Set the metadata values on the target device.
UpdateDeviceMetadataRequest body = new UpdateDeviceMetadataRequest
{
DeviceMetadata = metadata
};
var request = service.Partners.Devices.Metadata(body, PartnerId, targetDeviceId);
var results = request.Execute();
Python
# Allowed metadata dictionary keys.
METADATA_KEY_ENTRIES = "entries";
METADATA_KEY_PHONE_NUMBER = "phonenumber";
METADATA_KEY_ORDER_NUMBER = "ordernumber";
# ...
# Create the record with values.
new_metadata = {METADATA_KEY_ENTRIES:{ \
METADATA_KEY_PHONE_NUMBER:'+1 (800) 555-0100', \
METADATA_KEY_ORDER_NUMBER:'GOOG123/ABC-#123456'}}
# Set the metadata values on the target device.
response = service.partners().devices().metadata(
metadataOwnerId=PARTNER_ID,
deviceId=target_device_id,
body={'deviceMetadata':new_metadata}).execute()
อาร์กิวเมนต์ข้อมูลเมตาจะแทนที่ค่าข้อมูลเมตาที่มีอยู่สำหรับคีย์เดียวกัน
คุณลบข้อมูลเมตาออกจากอุปกรณ์ได้ ส่งสตริงว่างสำหรับข้อมูลเมตา
ค่าที่ต้องการลบ ตัวอย่างด้านล่างแสดงวิธีลบโทรศัพท์
หมายเลข:
Java
// Create the metadata record with the values.
DeviceMetadata metadata = new DeviceMetadata();
Map<String,String> entries = new HashMap<String, String>();
entries.put(METADATA_KEY_PHONE_NUMBER, "");
metadata.setEntries(entries);
// Call partners().devices().metadata() to remove the phone metadata from the device...
.NET
// Create the metadata record with empty values.
DeviceMetadata metadata = new DeviceMetadata
{
Entries = new Dictionary<string, string> {
{MetadataKeyPhoneNumber, ""}
}
};
// Call Partners.Devices.Metadata to remove the phone metadata from the device...
Python
# Create the metadata record with empty values.
metadata_to_remove = {METADATA_KEY_ENTRIES: {METADATA_KEY_PHONE_NUMBER:''}}
# Call partners().devices().metadata() to remove the phone number
# metadata from the device...
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eResellers can associate metadata, such as telephone and order numbers, with each device through the API or by uploading a CSV file in the zero-touch portal.\u003c/p\u003e\n"],["\u003cp\u003eMetadata can be assigned to Android devices using \u003ccode\u003ephonenumber\u003c/code\u003e and \u003ccode\u003eordernumber\u003c/code\u003e keys, while ChromeOS devices only use the \u003ccode\u003eordernumber\u003c/code\u003e key.\u003c/p\u003e\n"],["\u003cp\u003eBoth resellers and customers can view device metadata, but only resellers can associate metadata.\u003c/p\u003e\n"],["\u003cp\u003eYou can assign metadata to devices by using the \u003ccode\u003epartners.devices.metadata\u003c/code\u003e method or when creating devices with \u003ccode\u003eclaimAsync\u003c/code\u003e, including the metadata in the request.\u003c/p\u003e\n"],["\u003cp\u003eMetadata values for a specific key can be updated by providing new values, or deleted by providing an empty string for that metadata key.\u003c/p\u003e\n"]]],["Resellers can associate metadata, like telephone or order numbers, with devices via API calls or CSV uploads. This metadata can be viewed by resellers and customers. For Android, keys `phonenumber` and `ordernumber` are used; for ChromeOS, only `ordernumber` is available. Metadata is assigned using the `partners.devices.metadata` method, including it in `claimAsync`, or setting values via an API call. To delete metadata, empty string values should be passed for the target keys.\n"],null,["# Device metadata\n\nAs a reseller you can associate metadata, such as a telephone number or a\npurchase order number, with each device. You can associate metadata by calling\nthe API or by [uploading a CSV file](/zero-touch/guides/portal#devices-import)\nin the zero-touch portal. Table 1 shows who can associate and view metadata:\n\n**Table 1**. Metadata permissions\n\n| Task | Resellers | Customers |\n|---------------------------------------------------------------------|-----------|-----------|\n| Associate metadata by calling the API | | |\n| Associate metadata by uploading a CSV file to the zero-touch portal | | |\n| View device metadata in the results of API calls | | |\n| View device metadata in the zero-touch portal | | |\n\nAssign metadata\n---------------\n\nTo associate metadata with each device, call the\n[`partners.devices.metadata`](/zero-touch/reference/reseller/rest/v1/partners.devices/metadata) method. You can add\ntelephone and order numbers for your Android devices using keys from the table 2\nbelow:\n\n**Table 2**. Metadata keys for Android devices\n\n| Data | Key | Value type | Example |\n|------------------|---------------|------------|-----------------------|\n| Telephone number | `phonenumber` | String | *+1 (800) 555-0100* |\n| Order number | `ordernumber` | String | *GOOG#123/ABC-123456* |\n\nBoth metadata values are free-form strings, so you can use a format that makes\nsense for your organization.\n\nFor ChromeOS devices, you can use the keys from table 3 below:\n\n**Table 3**. Metadata keys for ChromeOS devices\n\n| Data | Key | Value type | Example |\n|--------------|---------------|------------|-----------------------|\n| Order number | `ordernumber` | String | *GOOG#123/ABC-123456* |\n\nTo assign metadata as you create devices, include the metadata when calling\n[`claimAsync`](/zero-touch/reference/reseller/rest/v1/partners.devices/claimAsync). The example below shows setting a\ntelephone number and order number for the existing device `TARGET_DEVICE_ID`: \n\n### Java\n\n```java\n// Allowed metadata dictionary keys.\nprivate static String METADATA_KEY_PHONE_NUMBER = \"phonenumber\";\nprivate static String METADATA_KEY_ORDER_NUMBER = \"ordernumber\";\n\n// ...\n// Create the metadata record with the values.\nDeviceMetadata metadata = new DeviceMetadata();\nMap\u003cString,String\u003e entries = new HashMap\u003cString, String\u003e();\nentries.put(METADATA_KEY_ORDER_NUMBER, \"GOOG123/ABC-#123456\");\nentries.put(METADATA_KEY_PHONE_NUMBER, \"+1 (800) 555-0100\");\nmetadata.setEntries(entries);\n\n// Set the metadata values on the target device.\nUpdateDeviceMetadataRequest body = new UpdateDeviceMetadataRequest();\nbody.setDeviceMetadata(metadata);\n\nDeviceMetadata response = service\n .partners()\n .devices()\n .metadata(PARTNER_ID, targetDeviceId, body)\n .execute();\n```\n\n### .NET\n\n```c#\n// Allowed metadata dictionary keys.\nprivate static string MetadataKeyPhoneNumber = \"phonenumber\";\nprivate static string MetadataKeyOrderNumber = \"ordernumber\";\n\n// ...\n// Create the metadata record with the values.\nDeviceMetadata metadata = new DeviceMetadata\n{\n Entries = new Dictionary\u003cstring, string\u003e {\n {MetadataKeyOrderNumber, \"GOOG123/ABC-#123456\"},\n {MetadataKeyPhoneNumber, \"+1 (800) 555-0100\"}\n }\n};\n\n// Set the metadata values on the target device.\nUpdateDeviceMetadataRequest body = new UpdateDeviceMetadataRequest\n{\n DeviceMetadata = metadata\n};\nvar request = service.Partners.Devices.Metadata(body, PartnerId, targetDeviceId);\nvar results = request.Execute();\n```\n\n### Python\n\n```python\n# Allowed metadata dictionary keys.\nMETADATA_KEY_ENTRIES = \"entries\";\nMETADATA_KEY_PHONE_NUMBER = \"phonenumber\";\nMETADATA_KEY_ORDER_NUMBER = \"ordernumber\";\n\n# ...\n# Create the record with values.\nnew_metadata = {METADATA_KEY_ENTRIES:{ \\\n METADATA_KEY_PHONE_NUMBER:'+1 (800) 555-0100', \\\n METADATA_KEY_ORDER_NUMBER:'GOOG123/ABC-#123456'}}\n\n# Set the metadata values on the target device.\nresponse = service.partners().devices().metadata(\n metadataOwnerId=PARTNER_ID,\n deviceId=target_device_id,\n body={'deviceMetadata':new_metadata}).execute()\n```\n\nYour metadata arguments replace existing metadata values for the same key.\n\nDelete metadata\n---------------\n\nYou can delete your metadata from devices. Pass empty strings for metadata\nvalues you want to delete. The example below shows how to delete the telephone\nnumber: \n\n### Java\n\n```java\n// Create the metadata record with the values.\nDeviceMetadata metadata = new DeviceMetadata();\nMap\u003cString,String\u003e entries = new HashMap\u003cString, String\u003e();\nentries.put(METADATA_KEY_PHONE_NUMBER, \"\");\nmetadata.setEntries(entries);\n\n// Call partners().devices().metadata() to remove the phone metadata from the device...\n```\n\n### .NET\n\n```c#\n// Create the metadata record with empty values.\nDeviceMetadata metadata = new DeviceMetadata\n{\n Entries = new Dictionary\u003cstring, string\u003e {\n {MetadataKeyPhoneNumber, \"\"}\n }\n};\n\n// Call Partners.Devices.Metadata to remove the phone metadata from the device...\n```\n\n### Python\n\n```python\n# Create the metadata record with empty values.\nmetadata_to_remove = {METADATA_KEY_ENTRIES: {METADATA_KEY_PHONE_NUMBER:''}}\n\n# Call partners().devices().metadata() to remove the phone number\n# metadata from the device...\n```"]]