Module: BrazeAPI::Endpoints::Users::Export

Included in:
Client
Defined in:
lib/braze_api/endpoints/users/export.rb

Overview

Methods to call the users/export endpoint from a client instance

Constant Summary collapse

PATH =
'/users/export/ids'

Instance Method Summary collapse

Instance Method Details

#export_users(email: nil, external_ids: [], fields_to_export: []) ⇒ Object

The main method calling the endpoint. Called with an email, array of external_ids, and the fields that you wish to export data on. can only search by one email at a time, but can search with multiple ids



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/braze_api/endpoints/users/export.rb', line 13

def export_users(email: nil, external_ids: [], fields_to_export: [])
  body = {}.tap do |b|
    b[:external_ids] = external_ids unless external_ids.empty?
    b[:email_address] = email if email && external_ids.empty?
    b[:fields_to_export] = fields_to_export unless fields_to_export.empty?
  end
  post(
    PATH,
    params: body
  )
end