Importing Heybooking data - Heyloyalty/api GitHub Wiki

Importing data to your Heycommerce- or Bookingdatabase

After activating your Heycommerce database (or Booking database) in Heyloyalty, you can opt for adding data using different methods. Below is described how our API import works.

The IntegrationID is available from your Heyloyalty account, when looking at your Heycommerce integration.

Authentication is the same as your account authentication.

When importing data, you need to define the fields in the import, as they appear in the file. See examples below for information as to how you can skip columns in your csv file.

name options note
file csv This should contain your file
delimiter , ; pipe what separates the
skip_header_line true or false Skip the first line of csv-file
date_format Y-m-d H:i:s Timeformat used in csv-file
sendErrorsTo [email protected] If any errors occur when checking the import, this email will be notified
duplicate_field email, bookingid... Defines what field should be the unique value, in case of duplicates
handle_existing update, overwrite what should be done in case of duplicates. Update will update the fields in the csv-file. Overwrite will update the fields and delete any non-updated
fields_selected[] These fields are defined by the data send in your csv-file

fields_selected[] can have as many repeats as necessary. If you wish to skip columns in the import-file, you can add these to the form, but leave the value empty. fields_selected[] will be imported in the order they appear in the file and mapped to the corresponding field, by the name of the given in value.

Event_type can be defined as either "bought" or "cancelled".

EG: if the first column in your importfile contains email, this should be the fields fields_selected[] with email as value

cURL example

curl --location -g --request POST 'https://tracking.heyloyalty.com/api/booking/import/[integration-ID]' \
--header 'Cache-Control: no-cache' \
    --header 'X-Request-Timestamp: Tue, 01 Nov 2021 12:52:38 GMT' \
--header 'Authorization: Basic MTIzNDoxMjM0' \
--form 'file=@"/path/to/file"' \
--form 'delimiter=","' \
--form 'skip_header_line="true"' \
--form 'date_format="iso8601"' \
--form 'sendErrorsTo="[email protected]"' \
--form 'fields_selected[]="email"' \
--form 'fields_selected[]=""' \
--form 'fields_selected[]="booking_id"' \
--form 'fields_selected[]="departure_date"' \
--form 'fields_selected[]=""' \
--form 'fields_selected[]="destination"' \
--form 'fields_selected[]=""' \
--form 'fields_selected[]="adult_count"' \
--form 'fields_selected[]="child_count"' \
--form 'fields_selected[]="price"' \	
--form 'fields_selected[]="status"'

Note: fields_selected[] with no value will skip this particular column in the file.

See imported data

You can see your imported bookings, by using a GET request and the following endpoint api/booking/show/{intgrationId}/{booking_id} Here you will need to replace the ID's with your specific ID's.

###Example

http://tracking.heyloyalty.com/api/booking/show/1234/bookingno1