إنشاء خوادم الطباعة وإدارتها

توضّح نماذج الطلبات الواردة في هذه الصفحة كيفية إدارة خوادم الطباعة باستخدام واجهة برمجة تطبيقات إدارة طابعات Chrome.

تستخدم جميع طلبات العيّنات المتغيّرات التالية:

  • TOKEN: رمز OAuth 2.0 الخاص بتطبيقك.
  • CUSTOMER_ID: معرّف العميل الفريد لحساب المؤسسة، ويسبقه الحرف "C". (مثال: C123abc4) يمكنك أيضًا إدخال my_customer للإشارة إلى رقم تعريف العميل الخاص بمؤسستك.

عرض قائمة بخوادم الطباعة أو البحث عنها

يطلب هذا النموذج قائمة بجميع خوادم الطباعة المرئية في المؤسسة.

طلب

curl -X GET \
  --header "Authorization: Bearer TOKEN" \
  "https://admin.googleapis.com/admin/directory/v1/customers/CUSTOMER_ID/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_ID/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_ID/chrome/printServers"

الردّ

يتضمّن الردّ الناجح رقم تعريف خادم الطباعة الذي تم إنشاؤه حديثًا:

{
  "name": "customers/C0234nab1/chrome/printServers/0gjdgxs0o422uq",
  "id": "0gjdgxs0o422uq",
  "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_ID/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_ID/chrome/printServers/0gjdgxs0o422uq"

الردّ

الاستجابة الناجحة فارغة.

إنشاء عدة خوادم طباعة في طلب واحد

ينشئ هذا النموذج عدة خوادم طباعة باستخدام الطريقة batchCreatePrintServers.

طلب

curl -X POST \
  -H "Content-Type: application/json" \
  --header "Authorization: Bearer TOKEN" \
  -d '{
    "requests": [
      {
        "parent": "customers/CUSTOMER_ID",
        "printServer": {
          "displayName": "General print server",
          "description": "Org-wide print queue",
          "uri": "ipp://192.168.10.15",
          "orgUnitId": "04fatzly26exj7b"
        }
    },
    {
        "parent": "customers/CUSTOMER_ID",
        "printServer": {
          "displayName": "Engineering print server",
          "description": "Print server for Engineering use only",
          "uri": "ipp://192.168.10.16",
          "orgUnitId": "04fatzly26exj7b"
        }
    }
  ]
  }' \
  "https://admin.googleapis.com/admin/directory/v1/customers/CUSTOMER_ID/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": "Engineering print server",
      "description": "Print server for Engineering 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_ID/chrome/printServers:batchDeletePrintServers"

الردّ

يتضمّن الردّ الناجح أرقام تعريف خوادم الطباعة التي تم حذفها:

{
  "printServerIds": [
    "0gjdgxs2d6170e",
    "0gjdgxs0sbbh87"
  ]
}