Modernizing the Fitbit Developer Experience.
The Fitbit Web APIs are moving to a new, scalable infrastructure. We will be deprecating the legacy Fitbit Web API in September 2026. To ensure uninterrupted data continuity for your users, you will need to migrate your applications. Detailed migration guides are live on the Google Health API developer site.
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.