The sample requests on this page illustrate how to manage print servers with the Chrome Printer Management API.
All sample requests use the following variables:
$TOKEN
:Your application's OAuth 2.0token.$CUSTOMER
:The unique customer ID of the enterprise account, prepended with "C". (Example:C123abc4
) You can also entermy_customer
to denote your own organization's customer ID.
List or search for print servers
This sample requests a list of all print servers that are visible in the organization.
Request
curl -X GET \
--header "Authorization: Bearer $TOKEN" \
"https://admin.googleapis /admin/directory/v1/customers/$CUSTOMER/chrome/printServers"
Response
{
"printServers":[
{
"name":"customers/C0202nabg/chrome/printServers/0gjdgxs2zla0y7",
"id":"0gjdgxs2zla0y7",
"displayName":"MarketingPrintServer",
"description":"Queueforcorpmarketingoversizejobs",
"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":"Productionprintserverforusermanuals",
"uri":"ipp://192.168.10.11 ",
"createTime":"2021-03-11T22:02:06.048469Z",
"orgUnitId":"04fatzly4jbjho9",
}
]
}
Get a particular print server
This sample requests details for a print server with the ID0gjdgxs2zla0y7
.
Request
curl -X GET \
--header "Authorization: Bearer $TOKEN" \
"https://admin.googleapis /admin/directory/v1/customers/$CUSTOMER/chrome/printServers/0gjdgxs2zla0y7"
Response
{
"name":"customers/C0234nab1/chrome/printServers/0gjdgxs2zla0y7",
"id":"0gjdgxs2zla0y7",
"displayName":"MarketingPrintServer",
"description":"Queueforcorpmarketingoversizejobs",
"uri":"ipp://192.168.10.13 ",
"createTime":"2021-03-11T21:41:34.779587Z",
"orgUnitId":"04fatzly26exj7b"
}
Create a print server
This sample adds a new print server in an organizational unit that has ID
04fatzly26exj7b
.
Request
curl-XPOST\
-H"Content-Type:application/json"\
--header"Authorization:Bearer$TOKEN"\
-d'{
"displayName":"hr-dept",
"description":"HRqueueforsensitivedocuments",
"uri":"ipp://192.168.10.14",
"orgUnitId":"04fatzly26exj7b"
}'\
"https://admin.googleapis.com/admin/directory/v1/customers/$CUSTOMER/chrome/printServers"
Response
{
"name":"customers/C0234nab1/chrome/printServers/0gjdgxs0o422uq",
"id":"0gjdgxs0o422uq",// Note: This is the ID of the newly created print server.
"displayName":"hr-dept",
"description":"HRqueueforsensitivedocuments",
"uri":"ipp://192.168.10.14 ",
"orgUnitId":"04fatzly26exj7b",
"createTime":"2021-03-11T23:19:27.180846Z",
"orgUnitId":"04fatzly26exj7b"
}
Update a print server
This sample updates the description of print server ID0gjdgxs0o422uq
.
Request
curl -X PATCH \
-H "Content-Type: application/json" \
--header "Authorization: Bearer $TOKEN" \
-d '{
"description": "General HR dept print server",
}' \
"https://admin.googleapis /admin/directory/v1/customers/$CUSTOMER/chrome/printServers/0gjdgxs0o422uq?updateMask=description"
Response
{
"name":"customers/C0234nab1/chrome/printServers/0gjdgxs0o422uq",
"id":"0gjdgxs0o422uq",
"displayName":"hr-dept",
"description":"GeneralHRdeptprintserver",
"uri":"ipp://192.168.10.14 ",
"createTime":"2021-03-11T23:19:27.180846Z",
"orgUnitId":"04fatzly26exj7b"
}
Delete a print server
This sample deletes the print server with ID0gjdgxs0o422uq
.
Request
curl -X DELETE \
--header "Authorization: Bearer $TOKEN" \
"https://admin.googleapis /admin/directory/v1/customers/$CUSTOMER/chrome/printServers/0gjdgxs0o422uq"
Response
A successful response is empty.
Create multiple print servers in one request
This sample creates multiple print servers, using the
batchCreatePrintServers
method.
Request
curl-XPOST\
-H"Content-Type:application/json"\
--header"Authorization:Bearer$TOKEN"\
-d'{
"requests":[
{
"parent":"customers/$CUSTOMER",
"printServer":{
"displayName":"Generalprintserver",
"description":"Org-wideprintqueue",
"uri":"ipp://192.168.10.15",
"orgUnitId":"04fatzly26exj7b"
}
},
{
"parent":"customers/$CUSTOMER",
"printServer":{
"displayName":"Engprintserver",
"description":"PrintserverforEnguseonly",
"uri":"ipp://192.168.10.16",
"orgUnitId":"04fatzly26exj7b"
}
}
]
}'\
"https://admin.googleapis.com/admin/directory/v1/customers/$CUSTOMER/chrome/printServers:batchCreatePrintServers"
Response
{
"printServers":[
{
"name":"customers/C0234nab1/chrome/printServers/0gjdgxs0sbbh87",
"id":"0gjdgxs0sbbh87",
"displayName":"Generalprintserver",
"description":"Org-wideprintqueue",
"uri":"ipp://192.168.10.15 ",
"createTime":"2021-03-12T01:10:32.957084Z",
"orgUnitId":"04fatzly26exj7b"
},
{
"name":"customers/C0234nab1/chrome/printServers/0gjdgxs2d6170e",
"id":"0gjdgxs2d6170e",
"displayName":"Engprintserver",
"description":"PrintserverforEnguseonly",
"uri":"ipp://192.168.10.16 ",
"createTime":"2021-03-12T01:10:32.956735Z",
"orgUnitId":"04fatzly26exj7b"
}
]
}
Delete multiple print servers in one request
This sample deletes multiple print servers in a single request, using the
batchDeletePrintServers
method.
Request
curl -X POST \
-H "Content-Type: application/json" \
--header "Authorization: Bearer $TOKEN" \
-d '{
"printServerIds": [ "0gjdgxs0sbbh87", "0gjdgxs2d6170e" ]
}' \
"https://admin.googleapis /admin/directory/v1/customers/$CUSTOMER/chrome/printServers:batchDeletePrintServers"
Response
{
"printServerIds":[// Successfully deleted print servers.
"0gjdgxs2d6170e",
"0gjdgxs0sbbh87"
]
}