Users
The following methods allow you to manage users in your database. User ID undefined is forbidden.
Add User
Adds a new user to the database.
Parameters
ID of your database.
ID of the user to be added.
Responses
Successful operation.
The userId does not match ^[a-zA-Z0-9_-:@.]+$.
User of the given userId is already present in the database. In many cases, you may consider this code a success – it only tells you that nothing has been written to the database.
Delete User
Deletes a user of the given userId from the database.
If there are any purchases, ratings, bookmarks, cart additions or detail views made by the user present in the database, they will be deleted in cascade as well.
Parameters
ID of your database.
ID of the user to be deleted.
Responses
Successful operation.
The userId does not match ''^[a-zA-Z0-9_-:@.]+$''.
User of the given userId is not present in the database. In many cases, you may consider this code a success – it only tells you that nothing has been deleted from the database since the user was already not present. If there is no additional info in the JSON response, you probably have an error in your URL.
Merge Users
Merges interactions (purchases, ratings, bookmarks, detail views ...) of two different users under a single user ID. This is especially useful for online e-commerce applications working with anonymous users identified by unique tokens such as the session ID. In such applications, it may often happen that a user owns a persistent account, yet accesses the system anonymously while, e.g., putting items into a shopping cart. At some point in time, such as when the user wishes to confirm the purchase, (s)he logs into the system using his/her username and password. The interactions made under anonymous session ID then become connected with the persistent account, and merging these two becomes desirable.
Merging happens between two users referred to as the target and the source. After the merge, all the interactions of the source user are attributed to the target user, and the source user is deleted.
By default, the Merge Users request is only available from server-side integrations for security reasons, to prevent potential abuse. If you need to call this request from a client-side environment (such as a web or mobile app), please contact our support and request access to enable this feature for your database.
Parameters
ID of your database.
ID of the target user.
ID of the source user.
Sets whether the user targetUserId should be created if not present in the database.
Responses
Successful operation.
The sourceUserId or targetUserId does not match ^[a-zA-Z0-9_-:@.]+$
The sourceUserId or targetUserId does not exist in the database. If there is no additional info in the JSON response, you probably have an error in your URL.
List Users
Gets a list of IDs of users currently present in the catalog.
Parameters
ID of your database.
Boolean-returning ReQL expression, which allows you to filter users to be listed. Only the users for which the expression is true will be returned.
The number of users to be listed.
Specifies the number of users to skip (ordered by userId).
With returnProperties=true, property values of the listed users are returned along with their IDs in a JSON dictionary.
Example response:
[
{
"userId": "user-81",
"country": "US",
"sex": "M"
},
{
"userId": "user-314",
"country": "CAN",
"sex": "F"
}
]Allows specifying which properties should be returned when returnProperties=true is set. The properties are given as a comma-separated list.
Example response for includedProperties=country:
[
{
"userId": "user-81",
"country": "US"
},
{
"userId": "user-314",
"country": "CAN"
}
]Responses
Successful operation.
Invalid URL.