इस पेज पर दिए गए सैंपल अनुरोधों में बताया गया है कि Chrome प्रिंटर मैनेजमेंट एपीआई की मदद से, प्रिंट सर्वर को कैसे मैनेज किया जाता है.
सैंपल के लिए किए गए सभी अनुरोधों में, इन वैरिएबल का इस्तेमाल किया जाता है:
$TOKEN
: आपके ऐप्लिकेशन का OAuth 2.0 टोकन.$CUSTOMER
: एंटरप्राइज़ खाते का यूनीक ग्राहक आईडी, जिसे "C" से पहले जोड़ा जाता है. (उदाहरण:C123abc4
) अपने संगठन का ग्राहक आईडी दिखाने के लिए,my_customer
भी डाला जा सकता है.
प्रिंट सर्वर की सूची बनाना या उन्हें खोजना
यह नमूना, संगठन में दिखने वाले सभी प्रिंट सर्वर की सूची का अनुरोध करता है.
अनुरोध
curl -X GET \
--header "Authorization: Bearer $TOKEN" \
"https://admin.googleapis.com/admin/directory/v1/customers/$CUSTOMER/chrome/printServers"
जवाब
{
"printServers": [
{
"name": "customers/C0202nabg/chrome/printServers/0gjdgxs2zla0y7",
"id": "0gjdgxs2zla0y7",
"displayName": "Marketing Print Server",
"description": "Queue for corp marketing oversize jobs",
"uri": "ipp://192.168.10.13",
"createTime": "2021-03-11T21:41:34.779587Z",
"orgUnitId": "04fatzly26exj7b"
},
{
"name": "customers/C0202nabg/chrome/printServers/0gjdgxs1eqkb32",
"id": "0gjdgxs1eqkb32",
"displayName": "Production",
"description": "Production print server for user manuals",
"uri": "ipp://192.168.10.11",
"createTime": "2021-03-11T22:02:06.048469Z",
"orgUnitId": "04fatzly4jbjho9",
}
]
}
कोई खास प्रिंट सर्वर पाना
यह सैंपल, 0gjdgxs2zla0y7
आईडी वाले प्रिंट सर्वर के लिए जानकारी का अनुरोध करता है.
अनुरोध
curl -X GET \
--header "Authorization: Bearer $TOKEN" \
"https://admin.googleapis.com/admin/directory/v1/customers/$CUSTOMER/chrome/printServers/0gjdgxs2zla0y7"
जवाब
{
"name": "customers/C0234nab1/chrome/printServers/0gjdgxs2zla0y7",
"id": "0gjdgxs2zla0y7",
"displayName": "Marketing Print Server",
"description": "Queue for corp marketing oversize jobs",
"uri": "ipp://192.168.10.13",
"createTime": "2021-03-11T21:41:34.779587Z",
"orgUnitId": "04fatzly26exj7b"
}
प्रिंट सर्वर बनाना
यह सैंपल, संगठन की ऐसी इकाई में एक नया प्रिंट सर्वर जोड़ता है जिसमें आईडी
04fatzly26exj7b
है.
अनुरोध
curl -X POST \
-H "Content-Type: application/json" \
--header "Authorization: Bearer $TOKEN" \
-d '{
"displayName": "hr-dept",
"description": "HR queue for sensitive documents",
"uri": "ipp://192.168.10.14",
"orgUnitId": "04fatzly26exj7b"
}' \
"https://admin.googleapis.com/admin/directory/v1/customers/$CUSTOMER/chrome/printServers"
जवाब
{
"name": "customers/C0234nab1/chrome/printServers/0gjdgxs0o422uq",
"id": "0gjdgxs0o422uq", // Note: This is the ID of the newly created print server.
"displayName": "hr-dept",
"description": "HR queue for sensitive documents",
"uri": "ipp://192.168.10.14",
"orgUnitId": "04fatzly26exj7b",
"createTime": "2021-03-11T23:19:27.180846Z",
"orgUnitId": "04fatzly26exj7b"
}
प्रिंट सर्वर अपडेट करना
यह सैंपल, प्रिंट सर्वर आईडी 0gjdgxs0o422uq
की जानकारी को अपडेट करता है.
अनुरोध
curl -X PATCH \
-H "Content-Type: application/json" \
--header "Authorization: Bearer $TOKEN" \
-d '{
"description": "General HR dept print server",
}' \
"https://admin.googleapis.com/admin/directory/v1/customers/$CUSTOMER/chrome/printServers/0gjdgxs0o422uq?updateMask=description"
जवाब
{
"name": "customers/C0234nab1/chrome/printServers/0gjdgxs0o422uq",
"id": "0gjdgxs0o422uq",
"displayName": "hr-dept",
"description": "General HR dept print server",
"uri": "ipp://192.168.10.14",
"createTime": "2021-03-11T23:19:27.180846Z",
"orgUnitId": "04fatzly26exj7b"
}
प्रिंट सर्वर मिटाना
यह सैंपल, 0gjdgxs0o422uq
आईडी वाला प्रिंट सर्वर मिटा देता है.
अनुरोध
curl -X DELETE \
--header "Authorization: Bearer $TOKEN" \
"https://admin.googleapis.com/admin/directory/v1/customers/$CUSTOMER/chrome/printServers/0gjdgxs0o422uq"
जवाब
सही जवाब वाला फ़ील्ड खाली है.
एक अनुरोध में एक से ज़्यादा प्रिंट सर्वर बनाना
यह सैंपल, batchCreatePrintServers
तरीके का इस्तेमाल करके कई प्रिंट सर्वर बनाता है.
अनुरोध
curl -X POST \
-H "Content-Type: application/json" \
--header "Authorization: Bearer $TOKEN" \
-d '{
"requests": [
{
"parent": "customers/$CUSTOMER",
"printServer": {
"displayName": "General print server",
"description": "Org-wide print queue",
"uri": "ipp://192.168.10.15",
"orgUnitId": "04fatzly26exj7b"
}
},
{
"parent": "customers/$CUSTOMER",
"printServer": {
"displayName": "Eng print server",
"description": "Print server for Eng use only",
"uri": "ipp://192.168.10.16",
"orgUnitId": "04fatzly26exj7b"
}
}
]
}' \
"https://admin.googleapis.com/admin/directory/v1/customers/$CUSTOMER/chrome/printServers:batchCreatePrintServers"
जवाब
{
"printServers": [
{
"name": "customers/C0234nab1/chrome/printServers/0gjdgxs0sbbh87",
"id": "0gjdgxs0sbbh87",
"displayName": "General print server",
"description": "Org-wide print queue",
"uri": "ipp://192.168.10.15",
"createTime": "2021-03-12T01:10:32.957084Z",
"orgUnitId": "04fatzly26exj7b"
},
{
"name": "customers/C0234nab1/chrome/printServers/0gjdgxs2d6170e",
"id": "0gjdgxs2d6170e",
"displayName": "Eng print server",
"description": "Print server for Eng use only",
"uri": "ipp://192.168.10.16",
"createTime": "2021-03-12T01:10:32.956735Z",
"orgUnitId": "04fatzly26exj7b"
}
]
}
एक अनुरोध में एक से ज़्यादा प्रिंट सर्वर मिटाना
यह सैंपल, batchDeletePrintServers
तरीके का इस्तेमाल करके, एक ही अनुरोध में कई प्रिंट सर्वर मिटा देता है.
अनुरोध
curl -X POST \
-H "Content-Type: application/json" \
--header "Authorization: Bearer $TOKEN" \
-d '{
"printServerIds": ["0gjdgxs0sbbh87", "0gjdgxs2d6170e"]
}' \
"https://admin.googleapis.com/admin/directory/v1/customers/$CUSTOMER/chrome/printServers:batchDeletePrintServers"
जवाब
{
"printServerIds": [ // Successfully deleted print servers.
"0gjdgxs2d6170e",
"0gjdgxs0sbbh87"
]
}