Docs : SDK : updateItem
updateItem lets you modify an existing item in a user's database. This API will return a promise that gets resolved once the item has been durably updated in the database.
userbase.updateItem({
databaseName: 'example-database-name',
item: { example: 'Updated Sample Item A' },
itemId: '0001'
}).then(() => {
// item updated
}).catch((e) => console.error(e))
Parameters
-
databaseName [string | Len: 1-100] - The database name to use.
-
item [object | string | number | boolean | null | Max size: 10 KB] - The object to overwrite the existing item with.
-
itemId [string | Len: 1-100] - The unique identifier of the item to replace.
Advanced Parameters
-
shareToken [string | optional] - The token used to access a shared database.
-
databaseId [string | optional] - The database's unique identifier.
-
writeAccess [object | null | undefined | false | optional] - Access controls for the item. If explicitly set to a falsey value, removes the controls already set.
- onlyCreator [boolean | optional] - If true, only the item creator or database owner can modify the item.
- users [Array | Max: 10 | optional] - The users allowed to modify the item.
Errors
- ParamsMustBeObject
- DatabaseNotOpen
- DatabaseNameMissing
- DatabaseNameMustBeString
- DatabaseNameCannotBeBlank
- DatabaseNameTooLong
- DatabaseNameRestricted
- DatabaseIdMustBeString
- DatabaseIdCannotBeBlank
- DatabaseIdInvalidLength
- DatabaseIdNotAllowed
- DatabaseIsReadOnly
- ItemIdMissing
- ItemIdMustBeString
- ItemIdCannotBeBlank
- ItemIdTooLong
- ItemMissing
- ItemInvalid
- ItemTooLarge
- ItemDoesNotExist
- ItemUpdateConflict
- TransactionUnauthorized
- UserNotSignedIn
- UserNotFound
- TooManyRequests
- ServiceUnavailable