Naar console

REST Resource: sites.versions

Resource: Version

A Version is the collection of configuration and static files that determine how a site is displayed.

JSON representation
{
  "name": string,
  "status": enum (VersionStatus),
  "config": {
    object (ServingConfig)
  },
  "labels": {
    string: string,
    ...
  },
  "createTime": string,
  "createUser": {
    object (ActingUser)
  },
  "finalizeTime": string,
  "finalizeUser": {
    object (ActingUser)
  },
  "deleteTime": string,
  "deleteUser": {
    object (ActingUser)
  },
  "fileCount": string,
  "versionBytes": string
}
Fields
name

string

The unique identifier for a version, in the format:

sites/site-name/versions/versionID

This name is provided in the response body when you call the versions.create endpoint.

status

enum (VersionStatus)

The deploy status of a version.

For a successful deploy, call the versions.create endpoint to make a new version (CREATED status), upload all desired files to the version, then update the version to the FINALIZED status.

Note that if you leave the version in the CREATED state for more than 12 hours, the system will automatically mark the version as ABANDONED.

You can also change the status of a version to DELETED by calling the versions.delete endpoint.

config

object (ServingConfig)

The configuration for the behavior of the site. This configuration exists in the firebase.json file.

labels

map (key: string, value: string)

The labels used for extra metadata and/or filtering.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

createTime

string (Timestamp format)

Output only. The time at which the version was created.

A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".

createUser

object (ActingUser)

Output only. Identifies the user who created the version.

finalizeTime

string (Timestamp format)

Output only. The time at which the version was FINALIZED.

A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".

finalizeUser

object (ActingUser)

Output only. Identifies the user who FINALIZED the version.

deleteTime

string (Timestamp format)

Output only. The time at which the version was DELETED.

A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".

deleteUser

object (ActingUser)

Output only. Identifies the user who DELETED the version.

fileCount

string (int64 format)

Output only. The total number of files associated with the version.
This value is calculated after a version is FINALIZED.

versionBytes

string (int64 format)

Output only. The total stored bytesize of the version.
This value is calculated after a version is FINALIZED.

VersionStatus

The current known status of a specific version in the deploy lifecycle.

Enums
VERSION_STATUS_UNSPECIFIED The default status; should not be intentionally used.
CREATED The version has been created, and content is currently being added to the version.
FINALIZED All content has been added to the version, and the version can no longer be changed.
DELETED The version has been deleted.
ABANDONED The version was not updated to FINALIZED within 12 hours and was automatically deleted.
EXPIRED The version is outside the site-configured limit for the number of retained versions, so the version's content is scheduled for deletion.

ServingConfig

The configuration for how incoming requests to a site should be routed and processed before serving content. The patterns are matched and applied according to a specific priority order.

JSON representation
{
  "headers": [
    {
      object (Header)
    }
  ],
  "redirects": [
    {
      object (Redirect)
    }
  ],
  "rewrites": [
    {
      object (Rewrite)
    }
  ],
  "cleanUrls": boolean,
  "trailingSlashBehavior": enum (TrailingSlashBehavior)
}
Fields
headers[]

object (Header)

A list of custom response headers that are added to the content if the request URL path matches the glob.

redirects[]

object (Redirect)

A list of globs that will cause the response to redirect to another location.

rewrites[]

object (Rewrite)

A list of rewrites that will act as if the service were given the destination URL.

cleanUrls

boolean

Defines whether to drop the file extension from uploaded files.

trailingSlashBehavior

enum (TrailingSlashBehavior)

Defines how to handle a trailing slash in the URL path.

Header

A header defines custom headers to add to a response should the request URL path match the pattern.

JSON representation
{
  "glob": string,
  "headers": {
    string: string,
    ...
  }
}
Fields
glob

string

Required. The user-supplied glob pattern to match against the request URL path.

headers

map (key: string, value: string)

Required. The additional headers to add to the response.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

Redirect

A redirect represents the configuration for returning an HTTP redirect response given a matching request URL path.

JSON representation
{
  "glob": string,
  "statusCode": number,
  "location": string
}
Fields
glob

string

Required. The user-supplied glob pattern to match against the request URL path.

statusCode

number

Required. The status HTTP code to return in the response. It must be a valid 3xx status code.

location

string

Required. The value to put in the HTTP location header of the response.
The location can contain capture group values from the pattern using a : prefix to identify the segment and an optional * to capture the rest of the URL. For example:

"glob": "/:capture*",
"statusCode": 301,
"location": "https://example.com/foo/:capture"

Rewrite

A rewrite represents an internal content rewrite on the version. If the pattern matches, the request will be handled as if it were to the destination path specified in the configuration.

JSON representation
{
  "glob": string,

  // Union field behavior can be only one of the following:
  "path": string,
  "function": string,
  "run": {
    object (CloudRunRewrite)
  }
  // End of list of possible types for union field behavior.
}
Fields
glob

string

Required. The user-supplied glob pattern to match against the request URL path.

Union field behavior. Required. The behavior of the rewrite. behavior can be only one of the following:
path

string

The URL path to rewrite the request to.

function

string

The function to proxy requests to. Must match the exported function name exactly.

run

object (CloudRunRewrite)

The request will be forwarded to Cloud Run.

CloudRunRewrite

A configured rewrite that directs requests to a Cloud Run service. If the Cloud Run service does not exist when setting or updating your Firebase Hosting configuration, then the request fails. Any errors from the Cloud Run service are passed to the end user (for example, if you delete a service, any requests directed to that service receive a 404 error).

JSON representation
{
  "serviceId": string,
  "region": string
}
Fields
serviceId

string

Required. User-defined ID of the Cloud Run service.

region

string

Optional. User-provided region where the Cloud Run service is hosted.
Defaults to us-central1 if not supplied.

TrailingSlashBehavior

Defines whether a trailing slash should be added or removed from the request URL path.

Enums
TRAILING_SLASH_BEHAVIOR_UNSPECIFIED No behavior is specified.
Files are served at their exact location only, and trailing slashes are only added to directory indexes.
ADD Trailing slashes are added to directory indexes as well as to any URL path not ending in a file extension.
REMOVE Trailing slashes are removed from directory indexes as well as from any URL path not ending in a file extension.

Methods

create

Creates a new version for a site.

delete

Deletes the specified version.