Using the Datto REST API for SaaS Protection

SaaS Protection’s new REST API lets vendors create a dynamic integration experience in a more reliable and scalable way. It is also available for MSPs that have an experienced technical background.

Creating an integration with SaaS Protection’s REST API provides an easy way to retrieve readily available backup status and seat data. The SaaS Protection’s REST API uses the industry-standard Swagger UI for an interactive documentation experience that allows developers to trial responses from their own devices on their portal accounts.

Creating an API Key

To access the API Configuration options:

  1. Log into the Datto Partner Portal with your Administrator credentials.
  2. Select Admin > Integrations.
  3. On the Integrations page, verify the API Keys tab is selected.
  4. Click Create API Key.
  5. In the Create API Key dialog, in the API Key Name box, enter a name.
  6. If applicable, complete the remaining fields and click Create. The API is enabled.

REST API Configuration options

The three-dot menu provides access to configuration options.

  • View keys: Displays public and private key(s).
  • Edit: Displays the Edit API screen.
  • Regenerate Key: Generates a new public API key.
  • Deactivate: Disables the Datto REST API.
  • Delete: Deletes the API key.
  • Try it out: Populates the REST API documentation with public and private key for testing purposes.

Accessing Datto REST API documentation

Click the Documentation button in the REST API options pane.

The pane will expand and open the API documentation, including basic API options and options for the individual endpoints.

REST API documentation pane options

  • Authorize: The REST API uses a basic authentication scheme, with an automatically generated public API key/secret API key.
  • Servers: This drop-down menu shows what server the API is currently communicating with, and lets you select different available servers.

REST API endpoint options

The REST API documentation provides a menu of all configurable endpoints. Click an endpoint to expand its options.

The endpoint will expand, showing all parameters accepted in the URL, as well as the JSON representation of the responses from the server.

Previewing API call results with the Swagger UI

The Swagger UI lets you change endpoint parameters, run "preview" API calls, and view detailed results of the change at the presentation and code levels.

In this view, you can:

  • change each parameter and get a preview of the change's effect.
  • see the responses generated by each preview request as a Curl command and URL.
  • see the HTTP response codes generated when the server responds to the API call preview.
  • download the JSON code block generated by your trial API calls.

A Datto device must be associated with the Partner Portal account for these options to function.

To change parameters and preview an API call:

  1. Click the Try it out button.
  2. Edit fields will open for each parameter. Make the changes you want, then click the Execute bar to make the new API call.

  3. In the Responses pane beneath the Execute bar, you can view the Curl commands, Request URL http code, response headers, and response code block. Click the Download button to download the code block as a JSON file. Click Clear to reset the API preview call.

Updating multiple seats with the bulkSeatChange endpoint

You can leverage the bulkSeatChange API endpoint, in combination with the PUT function, to license, unlicense, and pause multiple Microsoft 365 seats.

IMPORTANT  The API supports updating a maximum of 199 seats at a time.

Request syntax

When using this endpoint, the API request must follow the syntax shown below:

EXAMPLE  PUT /v1/saas/saasCustomerId/externalSubscriptionId/bulkSeatChange

Replace the highlighted placeholders with the following values:

  • saasCustomerId: This value follows the /seatManagement/users part of the URL that appears in your internet browser's address bar when you navigate to the Seat Management page of the client you'd like to manage. For example, if your URL contains ext.backupify.com/360466, the saasCustomerId is 360466.

  • externalSubscriptionId: This value precedes the /seatManagement/users part of the URL that appears in your internet browser's address bar when you navigate to the Seat Management page of the client you'd like to manage. For example, if your URL contains Classic:Office365:377380, that is the value you should use for externalSubscriptionId.

Request payload

The request payload must contain the following values:

  • seat_type: The license type you'd like to use for the seat; case-sensitive

    • Possible values: User, SharedMailbox, Site, TeamSite, Team

  • action_type: The action you'd like to take for the license; case-sensitive

    • Possible values: License, Unlicense, Pause

  • ids: The object IDs from the live Microsoft 365 environment for which you'd like to perform licensing actions, in quotations and separated by commas

    EXAMPLE  “object id”,”object id”