Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Latest commit

 

History

History
771 lines (552 loc) · 33.2 KB

CustomersApi.md

File metadata and controls

771 lines (552 loc) · 33.2 KB

VoucherifySdk::CustomersApi

All URIs are relative to https://api.voucherify.io

Method HTTP request Description
create_customer POST /v1/customers Create Customer
customer_permanently_deletion POST /v1/customers/{customerId}/permanent-deletion Delete Customer Permanently
delete_customer DELETE /v1/customers/{customerId} Delete Customer
get_customer GET /v1/customers/{customerId} Get Customer
import_customers_using_csv POST /v1/customers/importCSV Import and Update Customers using CSV
list_customer_activities GET /v1/customers/{customerId}/activities List Customer Activities
list_customer_segments GET /v1/customers/{customerId}/segments List Customer's Segments
list_customers GET /v1/customers List Customers
update_customer PUT /v1/customers/{customerId} Update Customer
update_customers_consents PUT /v1/customers/{customerId}/consents Update Customer's consents
update_customers_in_bulk POST /v1/customers/bulk/async Update Customers in bulk
update_customers_metadata_in_bulk POST /v1/customers/metadata/async Update Customers' Metadata in bulk

create_customer

create_customer(opts)

Create Customer

Creates a customer object. 📘 Upsert Mode If you pass an id or a source_id that already exists in the customer database, Voucherify will return a related customer object with updated fields.

Examples

require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
  # Configure API key authorization: X-App-Id
  config.api_key['X-App-Id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Id'] = 'Bearer'

  # Configure API key authorization: X-App-Token
  config.api_key['X-App-Token'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Token'] = 'Bearer'
end

api_instance = VoucherifySdk::CustomersApi.new
opts = {
  customers_create_request_body: VoucherifySdk::CustomersCreateRequestBody.new # CustomersCreateRequestBody | Create a customer with specified parameters.
}

begin
  # Create Customer
  result = api_instance.create_customer(opts)
  p result
rescue VoucherifySdk::ApiError => e
  puts "Error when calling CustomersApi->create_customer: #{e}"
end

Parameters

Name Type Description Notes
customers_create_request_body CustomersCreateRequestBody Create a customer with specified parameters. [optional]

Return type

CustomersCreateResponseBody

Authorization

X-App-Id, X-App-Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

customer_permanently_deletion

customer_permanently_deletion(customer_id)

Delete Customer Permanently

The organization user can remove consumer data permanently from the Voucherify system by using this API method. It deletes all customer data and connected resources. It makes the customer profile forgotten by Voucherify.

Examples

require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
  # Configure API key authorization: X-App-Id
  config.api_key['X-App-Id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Id'] = 'Bearer'

  # Configure API key authorization: X-App-Token
  config.api_key['X-App-Token'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Token'] = 'Bearer'
end

api_instance = VoucherifySdk::CustomersApi.new
customer_id = 'customer_id_example' # String | A Voucherify customers id or source_id.

begin
  # Delete Customer Permanently
  result = api_instance.customer_permanently_deletion(customer_id)
  p result
rescue VoucherifySdk::ApiError => e
  puts "Error when calling CustomersApi->customer_permanently_deletion: #{e}"
end

Parameters

Name Type Description Notes
customer_id String A Voucherify customers id or source_id.

Return type

CustomersPermanentDeletionCreateResponseBody

Authorization

X-App-Id, X-App-Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

delete_customer

delete_customer(customer_id)

Delete Customer

This method deletes a customer.

Examples

require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
  # Configure API key authorization: X-App-Id
  config.api_key['X-App-Id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Id'] = 'Bearer'

  # Configure API key authorization: X-App-Token
  config.api_key['X-App-Token'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Token'] = 'Bearer'
end

api_instance = VoucherifySdk::CustomersApi.new
customer_id = 'customer_id_example' # String | A Voucherify customers id or source_id.

begin
  # Delete Customer
  api_instance.delete_customer(customer_id)
rescue VoucherifySdk::ApiError => e
  puts "Error when calling CustomersApi->delete_customer: #{e}"
end

Parameters

Name Type Description Notes
customer_id String A Voucherify customers id or source_id.

Return type

nil (empty response body)

Authorization

X-App-Id, X-App-Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

get_customer

get_customer(customer_id)

Get Customer

Retrieve customer details.

Examples

require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
  # Configure API key authorization: X-App-Id
  config.api_key['X-App-Id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Id'] = 'Bearer'

  # Configure API key authorization: X-App-Token
  config.api_key['X-App-Token'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Token'] = 'Bearer'
end

api_instance = VoucherifySdk::CustomersApi.new
customer_id = 'customer_id_example' # String | A Voucherify customers id or source_id.

begin
  # Get Customer
  result = api_instance.get_customer(customer_id)
  p result
rescue VoucherifySdk::ApiError => e
  puts "Error when calling CustomersApi->get_customer: #{e}"
end

Parameters

Name Type Description Notes
customer_id String A Voucherify customers id or source_id.

Return type

CustomersGetResponseBody

Authorization

X-App-Id, X-App-Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

import_customers_using_csv

import_customers_using_csv(file)

Import and Update Customers using CSV

This API method lets you import or update customer data. To get a proper and valid response, please send a CSV file with data separated by commas. # Request Example # CSV File Format The CSV file has to include headers in the first line. All properties which cannot be mapped to standard customer fields will be added to the metadata object. 📘 Standard customer fields mapping No spaces allowed in field names Id, Name, Email, Phone, Birthdate, Source_id, Address_line_1, Address_line_2, Address_Postal_Code, Address_City, Address_State, Address_Country, Description, Metadata_name_1, Metadata_name_2 # Update Customers using CSV If you would like to update customers data, you can do it using the CSV file with new data. However, remember to include a source_id in your CSV file to manage the update successfully. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request.

Examples

require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
  # Configure API key authorization: X-App-Id
  config.api_key['X-App-Id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Id'] = 'Bearer'

  # Configure API key authorization: X-App-Token
  config.api_key['X-App-Token'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Token'] = 'Bearer'
end

api_instance = VoucherifySdk::CustomersApi.new
file = File.new('/path/to/some/file') # File | File path.

begin
  # Import and Update Customers using CSV
  result = api_instance.import_customers_using_csv(file)
  p result
rescue VoucherifySdk::ApiError => e
  puts "Error when calling CustomersApi->import_customers_using_csv: #{e}"
end

Parameters

Name Type Description Notes
file File File path.

Return type

CustomersImportCsvCreateResponseBody

Authorization

X-App-Id, X-App-Token

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

list_customer_activities

list_customer_activities(customer_id, opts)

List Customer Activities

Retrieve customer activities.

Examples

require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
  # Configure API key authorization: X-App-Id
  config.api_key['X-App-Id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Id'] = 'Bearer'

  # Configure API key authorization: X-App-Token
  config.api_key['X-App-Token'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Token'] = 'Bearer'
end

api_instance = VoucherifySdk::CustomersApi.new
customer_id = 'customer_id_example' # String | A Voucherify customers id or source ID of the customer who performed the activities.
opts = {
  limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items.
  order: VoucherifySdk::ParameterOrder::CREATED_AT, # ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.
  starting_after: Time.parse('2013-10-20T19:20:30+01:00'), # Time | A cursor for use in pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list.
  starting_after_id: 'starting_after_id_example', # String | By applying this filter value, you will get events starting after an event with the given ID.
  campaign_type: VoucherifySdk::ParameterCampaignType::PROMOTION, # ParameterCampaignType | Through this parameter you can control a type of campaign by which Voucherify will filter related customers activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM
  campaign_id: 'campaign_id_example', # String | By applying this parameter you request only events related to specific campaign identified by its ID.
  product_id: 'product_id_example', # String | By applying this parameter you request only events related to specific product identified by its ID.
  start_date: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.
  end_date: Time.parse('2013-10-20T19:20:30+01:00') # Time | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.
}

begin
  # List Customer Activities
  result = api_instance.list_customer_activities(customer_id, opts)
  p result
rescue VoucherifySdk::ApiError => e
  puts "Error when calling CustomersApi->list_customer_activities: #{e}"
end

Parameters

Name Type Description Notes
customer_id String A Voucherify customers id or source ID of the customer who performed the activities.
limit Integer A limit on the number of objects to be returned. Limit can range between 1 and 100 items. [optional]
order ParameterOrder Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. [optional]
starting_after Time A cursor for use in pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. [optional]
starting_after_id String By applying this filter value, you will get events starting after an event with the given ID. [optional]
campaign_type ParameterCampaignType Through this parameter you can control a type of campaign by which Voucherify will filter related customers activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM [optional]
campaign_id String By applying this parameter you request only events related to specific campaign identified by its ID. [optional]
product_id String By applying this parameter you request only events related to specific product identified by its ID. [optional]
start_date Time Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. [optional]
end_date Time Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. [optional]

Return type

CustomersActivitiesListResponseBody

Authorization

X-App-Id, X-App-Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

list_customer_segments

list_customer_segments(customer_id)

List Customer's Segments

Returns the list of segments IDs to which the customer belongs to. If you pass a customerId which is not stored and recognized by Voucherify as an existing customer in the system, the response will generate a list of segments that the customer would potentialy qualify for if they were to become a customer tracked in the system.

Examples

require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
  # Configure API key authorization: X-App-Id
  config.api_key['X-App-Id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Id'] = 'Bearer'

  # Configure API key authorization: X-App-Token
  config.api_key['X-App-Token'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Token'] = 'Bearer'
end

api_instance = VoucherifySdk::CustomersApi.new
customer_id = 'customer_id_example' # String | Unique identifier of a customer represented by an internal customer ID or customer source ID.

begin
  # List Customer's Segments
  result = api_instance.list_customer_segments(customer_id)
  p result
rescue VoucherifySdk::ApiError => e
  puts "Error when calling CustomersApi->list_customer_segments: #{e}"
end

Parameters

Name Type Description Notes
customer_id String Unique identifier of a customer represented by an internal customer ID or customer source ID.

Return type

CustomersSegmentsListResponseBody

Authorization

X-App-Id, X-App-Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

list_customers

list_customers(opts)

List Customers

Returns a list of customers.

Examples

require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
  # Configure API key authorization: X-App-Id
  config.api_key['X-App-Id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Id'] = 'Bearer'

  # Configure API key authorization: X-App-Token
  config.api_key['X-App-Token'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Token'] = 'Bearer'
end

api_instance = VoucherifySdk::CustomersApi.new
opts = {
  limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items.
  page: 56, # Integer | Which page of results to return.
  email: 'email_example', # String | Limit the customers to the ones that have this specific email address.
  city: 'city_example', # String | Limit the customers to the ones that are located in the specified city.
  name: 'name_example', # String | Filter customers by the name property.
  segment_id: 'segment_id_example', # String | Filter customers by the segment id.
  created_at_before: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Filter customers by date customer was created.
  created_at_after: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Filter customers by date customer was created.
  updated_at_before: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Filter customers by date customer was updated last time.
  updated_at_after: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Filter customers by date customer was updated last time.
  order: VoucherifySdk::ParameterOrderListCustomers::CREATED_AT, # ParameterOrderListCustomers | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.
  starting_after: Time.parse('2013-10-20T19:20:30+01:00') # Time | A cursor for use in pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list.  
}

begin
  # List Customers
  result = api_instance.list_customers(opts)
  p result
rescue VoucherifySdk::ApiError => e
  puts "Error when calling CustomersApi->list_customers: #{e}"
end

Parameters

Name Type Description Notes
limit Integer A limit on the number of objects to be returned. Limit can range between 1 and 100 items. [optional]
page Integer Which page of results to return. [optional]
email String Limit the customers to the ones that have this specific email address. [optional]
city String Limit the customers to the ones that are located in the specified city. [optional]
name String Filter customers by the name property. [optional]
segment_id String Filter customers by the segment id. [optional]
created_at_before Time Filter customers by date customer was created. [optional]
created_at_after Time Filter customers by date customer was created. [optional]
updated_at_before Time Filter customers by date customer was updated last time. [optional]
updated_at_after Time Filter customers by date customer was updated last time. [optional]
order ParameterOrderListCustomers This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. [optional]
starting_after Time A cursor for use in pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. [optional]

Return type

CustomersListResponseBody

Authorization

X-App-Id, X-App-Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

update_customer

update_customer(customer_id, opts)

Update Customer

Updates the specified customer by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.

Examples

require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
  # Configure API key authorization: X-App-Id
  config.api_key['X-App-Id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Id'] = 'Bearer'

  # Configure API key authorization: X-App-Token
  config.api_key['X-App-Token'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Token'] = 'Bearer'
end

api_instance = VoucherifySdk::CustomersApi.new
customer_id = 'customer_id_example' # String | A Voucherify customers id or source_id.
opts = {
  customers_update_request_body: VoucherifySdk::CustomersUpdateRequestBody.new # CustomersUpdateRequestBody | Specify the parameters to be updated.
}

begin
  # Update Customer
  result = api_instance.update_customer(customer_id, opts)
  p result
rescue VoucherifySdk::ApiError => e
  puts "Error when calling CustomersApi->update_customer: #{e}"
end

Parameters

Name Type Description Notes
customer_id String A Voucherify customers id or source_id.
customers_update_request_body CustomersUpdateRequestBody Specify the parameters to be updated. [optional]

Return type

CustomersUpdateResponseBody

Authorization

X-App-Id, X-App-Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

update_customers_consents

update_customers_consents(customer_id, opts)

Update Customer's consents

Update marketing permissions for the specified customer.

Examples

require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
  # Configure API key authorization: X-App-Id
  config.api_key['X-App-Id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Id'] = 'Bearer'

  # Configure API key authorization: X-App-Token
  config.api_key['X-App-Token'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Token'] = 'Bearer'
end

api_instance = VoucherifySdk::CustomersApi.new
customer_id = 'customer_id_example' # String | A Voucherify unique customer identifier or source ID.
opts = {
  body: { ... } # Object | Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value.   ## Examples  Opt-out from all communication: 
}

begin
  # Update Customer's consents
  api_instance.update_customers_consents(customer_id, opts)
rescue VoucherifySdk::ApiError => e
  puts "Error when calling CustomersApi->update_customers_consents: #{e}"
end

Parameters

Name Type Description Notes
customer_id String A Voucherify unique customer identifier or source ID.
body Object Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value. ## Examples Opt-out from all communication: [optional]

Return type

nil (empty response body)

Authorization

X-App-Id, X-App-Token

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

update_customers_in_bulk

update_customers_in_bulk(opts)

Update Customers in bulk

Update several customers in one asynchronous operation. In one request, it is possible to update a maximum of 100 records. In the response body, you get a unique async action identifier. If a requested customer object is not found, then an upsert occurs. This is reflected in the Get Async Action endpoint as follows: This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request.

Examples

require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
  # Configure API key authorization: X-App-Id
  config.api_key['X-App-Id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Id'] = 'Bearer'

  # Configure API key authorization: X-App-Token
  config.api_key['X-App-Token'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Token'] = 'Bearer'
end

api_instance = VoucherifySdk::CustomersApi.new
opts = {
  customers_update_in_bulk_request_body: [VoucherifySdk::CustomersUpdateInBulkRequestBody.new({source_id: 'source_id_example'})] # Array<CustomersUpdateInBulkRequestBody> | Specify the customer fields that you would like to update in each customer object.
}

begin
  # Update Customers in bulk
  result = api_instance.update_customers_in_bulk(opts)
  p result
rescue VoucherifySdk::ApiError => e
  puts "Error when calling CustomersApi->update_customers_in_bulk: #{e}"
end

Parameters

Name Type Description Notes
customers_update_in_bulk_request_body Array<CustomersUpdateInBulkRequestBody> Specify the customer fields that you would like to update in each customer object. [optional]

Return type

CustomersUpdateInBulkResponseBody

Authorization

X-App-Id, X-App-Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

update_customers_metadata_in_bulk

update_customers_metadata_in_bulk(opts)

Update Customers' Metadata in bulk

Update several customers metadata properties in one asynchronous operation. In one request, it is possible to update a maximum of 100 records. In the response body, you get a unique async action identifier. If a requested customer object is not found, then an upsert occurs. This is reflected in the Get Async Action endpoint as follows: This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request.

Examples

require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
  # Configure API key authorization: X-App-Id
  config.api_key['X-App-Id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Id'] = 'Bearer'

  # Configure API key authorization: X-App-Token
  config.api_key['X-App-Token'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-App-Token'] = 'Bearer'
end

api_instance = VoucherifySdk::CustomersApi.new
opts = {
  customers_metadata_update_in_bulk_request_body: VoucherifySdk::CustomersMetadataUpdateInBulkRequestBody.new({source_ids: ['source_ids_example'], metadata: 3.56}) # CustomersMetadataUpdateInBulkRequestBody | List the source_ids of the customers you would like to update along with the metadata key value pairs.
}

begin
  # Update Customers' Metadata in bulk
  result = api_instance.update_customers_metadata_in_bulk(opts)
  p result
rescue VoucherifySdk::ApiError => e
  puts "Error when calling CustomersApi->update_customers_metadata_in_bulk: #{e}"
end

Parameters

Name Type Description Notes
customers_metadata_update_in_bulk_request_body CustomersMetadataUpdateInBulkRequestBody List the source_ids of the customers you would like to update along with the metadata key value pairs. [optional]

Return type

CustomersMetadataUpdateInBulkResponseBody

Authorization

X-App-Id, X-App-Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json