- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- IAM Permissions
- Try it!
Gets the capacity history.
HTTP request
POST https://compute.googleapis.com/compute/beta/projects/{project}/regions/{region}/advice/capacityHistory
The URLs use gRPC Transcoding syntax.
Path parameters
| Parameters | |
|---|---|
project
|
Project ID for this request. |
region
|
Name of the region for this request. |
Request body
The request body contains data with the following structure:
| JSON representation |
|---|
{ "instanceProperties" : { "machineType" : string , "scheduling" : { "provisioningModel" : enum } } , "locationPolicy" : { "location" : string } , "types" : [ enum ] } |
instanceProperties
object
Instance properties for this request.
instanceProperties.machineType
string
The machine type for the VM, such as n2-standard-4
.
instanceProperties.scheduling
object
Specifies the scheduling options.
instanceProperties.scheduling.provisioningModel
enum
The provisioning model to get capacity history for. This field must be set to SPOT
.
For more information, see Compute Engine instances provisioning models .
locationPolicy
object
Location policy for this request.
locationPolicy.location
string
The region or zone to get capacity history for.
It can be a partial or full URL. For example, the following are valid values:
-
https://www.googleapis.com/compute/v1/projects/ project /zones/ zone -
projects/ project /zones/ zone -
zones/ zone
This field is optional.
types[]
enum
List of history types to get capacity history for.
Response body
Contains the capacity history.
If successful, the response body contains data with the following structure:
| JSON representation |
|---|
{ "machineType" : string , "location" : string , "preemptionHistory" : [ { "interval" : { "startTime" : string , "endTime" : string } , "preemptionRate" : number } ] , "priceHistory" : [ { "interval" : { "startTime" : string , "endTime" : string } , "listPrice" : { "currencyCode" : string , "units" : string , "nanos" : integer } } ] } |
| Fields | |
|---|---|
machineType
|
|
location
|
|
preemptionHistory[]
|
|
preemptionHistory[].interval
|
|
preemptionHistory[].interval.startTime
|
Optional. Inclusive start of the interval. If specified, a Timestamp matching this interval will have to be the same or after the start. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
preemptionHistory[].interval.endTime
|
Optional. Exclusive end of the interval. If specified, a Timestamp matching this interval will have to be before the end. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
preemptionHistory[].preemptionRate
|
|
priceHistory[]
|
|
priceHistory[].interval
|
|
priceHistory[].interval.startTime
|
Optional. Inclusive start of the interval. If specified, a Timestamp matching this interval will have to be the same or after the start. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
priceHistory[].interval.endTime
|
Optional. Exclusive end of the interval. If specified, a Timestamp matching this interval will have to be before the end. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
priceHistory[].listPrice
|
|
priceHistory[].listPrice.currencyCode
|
The three-letter currency code defined in ISO 4217. |
priceHistory[].listPrice.units
|
The whole units of the amount. For example if |
priceHistory[].listPrice.nanos
|
Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If |
Authorization scopes
Requires one of the following OAuth scopes:
-
https://www.googleapis.com/auth/compute -
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview .
IAM Permissions
In addition to any permissions specified on the fields above, authorization requires one or more of the following IAM permissions:
-
compute.advice.capacityHistory
To find predefined roles that contain those permissions, see Compute Engine IAM Roles .

