![](https://sandeeppote.com/wp-content/uploads/2023/02/image-270.png)
Prepare guest data file to upload
Prepare Json file
Take a sample guest data from here –
Sample data guest looks like this-
{
"ref":"b4b92667-54e9-444f-8f64-11672fe9843a",
"schema":"guest",
"mode":"upsert",
"value":{
"guestType":"customer",
"firstSeen":"2010-03-07T16:15:11.000Z",
"lastSeen":"2012-08-23T16:17:16.000Z",
"firstName": "Eager",
"lastName": "Benz",
"email": "eager.benz@malify.com",
"extensions":[
{
"name":"ext",
"key":"default",
"loyaltytier":"level2",
"rewardBalance":"50125"
}
]
}
}
{
"ref":"0cc6c80b-0b19-446f-9e14-579f75a96c4a",
"schema":"guest",
"mode":"upsert",
"value":{
"guestType":"customer",
"firstSeen":"2010-03-07T16:15:11.000Z",
"lastSeen":"2012-08-23T16:17:16.000Z",
"firstName": "Goofy",
"lastName": "Trovalds",
"email": "goofy.trovalds@malify.com",
"extensions":[
{
"name":"ext",
"key":"default",
"loyaltytier":"level3",
"rewardBalance":"50130"
}
]
}
}
Load the data in json file. Note that the above is a single row in a json and repeat the rows to upload multiple guets. This is not a json formatted file and should not have “,” to seperate rows as normally json file has. Highlighted email is important to identify the customer and add/update the extended data. This depends on the rule setup for your environment to identify the customer.
gzip the json file to upload
Example-
tar -czvf guest-upload.gz .\guest-upload.json
Generate MD5 File Checksum
Upload the gzip file to generate the check sum on this url –
https://emn178.github.io/online-tools/md5_checksum.html
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-136.png)
Prepare Pre-signed Request
Create a new guid for the below batch upload. This guid will be used to know the status of the batch upload.
https://api.boxever.com/v2/batches/<<your guid>>
Request body –
{
"checksum": "aaab5899b405bc3cb1d9b*******",
"size": 412
}
Setup the Basic Auth before sending the request-
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-122.png)
Request after setting up Authentication and body-
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-137.png)
Response-
location – where the file needs to be uploaded. Will see this is next request where we actually upload file.
expiry – date time until the location to upload file is valid
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-138.png)
The response should be saved in environment with uploadURL and batchRef variable-
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-127.png)
Upload file
Upload URL request should contain the URL received from the pre-signed request-
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-128.png)
Set the headers-
x-amz-server-side-encryption – AES256
Content-Md5 – <<Hex to Base checksum value>>
Content-Md5 is the Hex to Base64 converted value of checksum
Use this url to convert to base64-
https://base64.guru/converter/encode/hex
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-135.png)
Request Headers should look like this-
The request signature we calculated does not match the signature you provided. Check your key and signing method.
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-134.png)
Send request to the provided URL with the attached gzip file and headers. Response 200 Ok
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-139.png)
Check the status of the uploaded file-
https://api.boxever.com/v2/batches/{{batchRef}}
The upload is queued and may take time depending on the items queued.
With the below request it shows the upload request is processing.
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-140.png)
This request took almost 2 hours to complete, and the response here is error where 1 of the guets is updated but opther failed.
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-141.png)
This is the log, where you should be able to rectify any errors in json file-
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-142.png)
Lets check the other guest if available in portal-
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-143.png)
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-144.png)
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-145.png)
Errors–
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-123.png)
SignatureDoesNotMatch
![](https://sandeeppote.com/wp-content/uploads/2023/02/image-132.png)