Method: projects.notificationChannels.getVerificationCode

Requests a verification code for an already verified channel that can then be used in a call to notificationChannels.verify() on a different channel with an equivalent identity in the same or in a different project. This makes it possible to copy a channel between projects without requiring manual reverification of the channel. If the channel is not in the verified state, this method will fail (in other words, this may only be used if the notificationChannels.sendVerificationCode and notificationChannels.verify paths have already been used to put the given channel into the verified state).

There is no guarantee that the verification codes returned by this method will be of a similar structure or form as the ones that are delivered to the channel via notificationChannels.sendVerificationCode; while notificationChannels.verify() will recognize both the codes delivered via notificationChannels.sendVerificationCode() and returned from notificationChannels.getVerificationCode(), it is typically the case that the verification codes delivered via notificationChannels.sendVerificationCode() will be shorter and also have a shorter expiration (e.g. codes such as "G-123456") whereas GetVerificationCode() will typically return a much longer, websafe base 64 encoded string that has a longer expiration time.

HTTP request

POST https://monitoring.googleapis.com/v3/{name}:getVerificationCode

Path parameters

Parameters
name

string

Required. The notification channel for which a verification code is to be generated and retrieved. This must name a channel that is already verified; if the specified channel is not verified, the request will fail.

Authorization requires the following IAM permission on the specified resource name:

  • monitoring.notificationChannels.getVerificationCode

Request body

The request body contains data with the following structure:

JSON representation
{
  "expireTime": string
}
Fields
expireTime

string (Timestamp format)

The desired expiration time. If specified, the API will guarantee that the returned code will not be valid after the specified timestamp; however, the API cannot guarantee that the returned code will be valid for at least as long as the requested time (the API puts an upper bound on the amount of time for which a code may be valid). If omitted, a default expiration will be used, which may be less than the max permissible expiration (so specifying an expiration may extend the code's lifetime over omitting an expiration, even though the API does impose an upper limit on the maximum expiration that is permitted).

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

Response body

The notificationChannels.getVerificationCode request.

If successful, the response body contains data with the following structure:

JSON representation
{
  "code": string,
  "expireTime": string
}
Fields
code

string

The verification code, which may be used to verify other channels that have an equivalent identity (i.e. other channels of the same type with the same fingerprint such as other email channels with the same email address or other sms channels with the same number).

expireTime

string (Timestamp format)

The expiration time associated with the code that was returned. If an expiration was provided in the request, this is the minimum of the requested expiration in the request and the max permitted expiration.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/monitoring

For more information, see the Authentication Overview.