Method: devices.create

  • This webpage details the process of creating an ambient device within a user's Google Photos account via an HTTP POST request to https://photosambient.googleapis.com/v1/devices.

  • A requestId query parameter is mandatory, requiring a unique, client-provided UUID in the format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" to prevent device duplication.

  • The request body must contain an instance of AmbientDevice, and upon success, the response body will contain the newly created AmbientDevice.

  • Creating an ambient device requires authorization with the https://www.googleapis.com/auth/photosambient.mediaitems OAuth scope.

  • There is a limit of 100 devices per user, and attempting to exceed this limit results in a RESOURCE_EXHAUSTED error.

Creates an ambient device in the user's Google Photos account.

If a device with the provided requestId already exists, an ALREADY_EXISTS error is returned. To help prevent duplicate devices, do the following:

  • If you know the deviceId of the existing device, call devices.get to retrieve it.
  • If you don't know the deviceId, call devices.delete with the requestId to remove the orphaned device before retrying this method.

You may create up to 100 devices per user of your app. If that limit is exceeded, a RESOURCE_EXHAUSTED error is returned.

HTTP request

POST https://photosambient.googleapis.com/v1/devices

The URL uses gRPC Transcoding syntax.

Query parameters

Parameters
requestId

string

Optional. A client-provided unique identifier for this request. This is used to mitigate resource duplication in the event of a network failure.

This ID must have the format of a UUID (version 4) string and follow these requirements:

  • Must not contain any sensitive identifying information about the user.
  • Must contain 32 hexadecimal characters divided into five groups separated by hyphens, in the format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" (or 8-4-4-4-12).

Request body

The request body contains an instance of AmbientDevice.

Response body

If successful, the response body contains a newly created instance of AmbientDevice.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/photosambient.mediaitems