var users = new List<User>
{
new User { Id = userIds[0], Data = new Dictionary<string, object> { { "field", "value1" } } },
new User { Id = userIds[1], Data = new Dictionary<string, object> { { "field", "value2" } } },
};
//overrideExisting: to override existing users or skip themwith conflicting userIDs
var addResponse = await Client.UsersBatch.UpsertUsersAsync(users, overrideExisting: false);
Batch Endpoints
You can use batch endpoints to insert, delete or read multiple entries at once. These three endpoints are only available when running Stream on your backend.
Upsert
Upsert allows you to insert or update up to 1000 entries with a single API call. The payload is an array of entries. Entries that already exist (same ID) will be updated with the new version.
Get Many
This method allows you to retrieve up to 1000 entries by ID.
//userIds list of userIds as string to fetch
var getUsersResponse = await Client.UsersBatch.GetUsersAsync(userIds);
Delete Many
This method allows you to delete up to 1000 entries by ID.
//userIds list of userIds as string to delete
var deleteResponse = await Client.UsersBatch.DeleteUsersAsync(userIds);
On this page: