printer: create

Namespace: microsoft.graph

Important

Microsoft is offering usage of the cloud printing APIs to manage Universal Print at no charge and there are no foreseeable plans to charge for the use of these APIs.

Create (register) a printer with the Universal Print service. This is a long-running operation and as such, it returns a printerCreateOperation that can be used to track and verify the registration of the printer.

For help creating the required Certificate Signing Request (CSR) for creating printer, see the CSR generation code sample.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

In addition to the following permissions, the user's tenant must have an active Universal Print subscription. The signed in user must be a Printer Administrator.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) Printer.Create, Printer.ReadWrite.All, Printer.FullControl.All
Delegated (personal Microsoft account) Not Supported.
Application Not supported.

HTTP request

POST /print/printers/create

Request headers

Name Description
Authorization Bearer {token}. Required.
Content-Type application/json. Required.

Request body

In the request body, supply a JSON representation of the parameters.

The following table shows the parameters that can be used with this action.

Parameter Type Description Required?
displayName String The display name to assign to the printer. Yes
manufacturer String The manufacturer of the printer. Yes
model String The model of the printer. Yes
physicalDeviceId String The physical device UUID of the printer. Required if the hasPhysicalDevice property is true. No
hasPhysicalDevice Boolean True if the printer has physical output device, false otherwise. If omitted, the default value is true. No
certificateSigningRequest printCertificateSigningRequest The X.509 Certificate Signing Request (CSR) for the certificate created and used by the printer to identify itself. Yes
connectorId String ID of the connector acting as proxy to the printer. No

Response

If successful, this method returns a 202 Accepted response code and a link to the associated printerCreateOperation in the Operation-Location header.

You make a GET request to the linked URL to get the status of an ongoing printer registration. After printer registration has completed successfully, a GET request to the linked URL will contain the created printer object and registered certificate.

Examples

Request

POST https://graph.microsoft.com/v1.0/print/printers/create
Content-Type: application/json
Content-length: 287

{
  "displayName": "Test Printer",
  "manufacturer": "Test Printer Manufacturer",
  "model": "Test Printer Model",
  "physicalDeviceId": null,
  "hasPhysicalDevice": false,
  "certificateSigningRequest": { 
    "content": "{content}",
    "transportKey": "{sampleTransportKey}"
  },
  "connectorId": null
}

Response

HTTP/1.1 202 Accepted
Operation-Location: https://graph.microsoft.com/v1.0/print/operations/f221760a-52e8-4c11-b8c5-5dfaef3a49db
Retry-After: 5