Support for the legacy Fitbit Web API ends on September 30, 2026
Important: Support for the legacy Fitbit Web API ends on September 30, 2026. After this date the API will continue to operate, but Google will no longer fix bugs or provide API support. On October 30, 2026, the Fitbit Web API will be turned off and will no longer function or sync data to or from Fitbit users. To continue accessing data for your users after this date, migrate to the Google Health API.
Storage API
chevron down
 

Storage API

Interface: Storage

Represents a logical list of key/value pairs.

This API is modeled after the WebStorage API, as defined here.

NOTE: Accessing items as JavaScript properties is not supported in this API.

Implemented by live-storage.LiveStorage

Properties

readonly length

number

Number of key/value pairs currently present in the list associated with the object.

Methods

clear()

Returns: void

Remove all key/value pairs.

getItem()

getItem(key: string)

Returns: string or null

Get the current value associated with a key.

Parameter: key name of the key for the requested value.

key()

key(index: number)

Returns: string or null

Get the name of a key by index.

The order of keys is not defined, but is consistent within an storage object so long as the number of keys doesn't change. So, adding or removing a key may change the order of the keys, but merely changing the value of an existing key does not.

Parameter: index Index of the key to get.

removeItem()

removeItem(key: string)

Returns: void

Remove a key/value pair with that key if one exists.

Parameter: key Name of the key for the key/value pair to remove.

setItem()

setItem(key: string, value: string)

Returns: void

Set the value associated with a key.

If a key/value pair with the given key already exists, it is replaced with the new value. If no key/value pair with the given key already exists, a new key/value pair with the given key and value is added.

Parameter: value Value to associate with key.

Throws: Throws a [QuotaExceededError] error if the value could not be changed or a new key/value pair could not be added.