# Sending Analytics Data Using Other Providers

### Introduction

The purpose of this document is to describe how to format, structure, and send a pre-defined custom data upload to an instance using the Fredhopper Data API.

The custom upload process sends additional data/content to your Fredhopper environment and prepares it to be enriched with the main product data that comes in via the feed. It's important to note that the newly added data doesn't get added into the existing Fredhopper index immediately when the upload job has completed successfully. This happens when the system processes the subsequent full product feed that takes place afterwards. The last successful custom file is always maintained by the system for all future product feed updates until a new file is sent and successfully processed via the custom upload process.

This document focuses on standard functionality and best practices that should be implemented in all integrations. It does not cover any customer-specific requirements that are defined with the assistance of your Technical Consultant.

If you do not have a custom data requirement for your Fredhopper solution then this process is not applicable to you. If you would like to find out more about the possibility of setting up a custom data upload solution with your Fredhopper implementation, please contact your Customer Success Manager.

### Upload

The following section details the standard data input format expected by the Upload service. It also explains how these files should be transmitted to Fredhopper's Managed Services environment and for the data to be triggered on the instance. Once the additional data is successfully uploaded and processed, it is then integrated with the next product feed update (full or incremental). The same custom data is maintained for all subsequent load-data triggers until a new version of the custom data is uploaded using this process.

#### Uploading and Triggering the processing of data using Upload

Once the custom file(s) is/are ready in the predefined format, it then needs to be compressed using the zip archive specification (application/zip) before it can be uploaded. An MD5 checksum of the newly created ZIP file also needs to be generated to verify the file.

Fredhopper offers a REST and File (FTP) API. The File (FTP) API is suitable for development purposes, while for production use we strongly recommend using the REST API.

<table><thead><tr><th width="107.1435546875">Region</th><th width="125.30755615234375">Countries</th><th width="328.95294189453125">Data Endpoint</th></tr></thead><tbody><tr><td>EU</td><td>All</td><td>https://my.eu1.fredhopperservices.com/upload:[service_instance]/data/input/</td></tr></tbody></table>

The **service\_instance** is either **live1**, test1, test2 or test3, depending on the environments that are available for you.

Steps:

1. Compress the data file(s) into one data.zip file.
2. Create MD5 checksum of data.zip file to validate that upload file is not corrupt, e.g.:\
   `DB211B14E25CFB18792C3B3697CD0394 data.zip`
3. Upload the data.zip file and the MD5 checksum to environment.\
   **REST URL via HTTP PUT:**\
   \&#xNAN;\_<https://my.eu1.fredhopperservices.com/upload:\\[service\\_instance]/data/input/data.zip?checksum=\\[checksum]_\\>
   **cURL example:**\
   `curl -D - -u "[cloud_username]":"[cloud_password]" -X PUT -H "Content-Type: application/zip" --data-binary @data.zip https://my.eu1.fredhopperservices.com/upload:live1/data/input/data.zip\?checksum=19afc8c99ec7ea27f0dba8e1c4fcff1f`
4. Save the data-id value from the response body for tracking purposes.\
   `HTTP/1.1 100 Continue`\
   `HTTP/1.1 201 Created`

   `Date: Fri, 21 Feb 2020 15:31:55 GMT`

   `Server: Jetty(9.4.22.v20191022)`

   `Location: https://my.eu1.fredhopperservices.com/upload:live1/data`

   `/input/2020-02-21_15-31-55`

   `Content-Type: text/plain`

   `Content-Length: 28`

   `Connection: close`

   `data-id=2020-02-21_15-31-55`
5. Trigger the processing of the newly uploaded data by creating a trigger that included the data-id value that was captured in step 4.\
   **REST URL:**\
   \&#xNAN;\_<https://my.eu1.fredhopperservices.com/upload:\\[service\\_instance]/trigger/finalize_\\>
   **cURL example:**\
   `curl -D - -u "[cloud_username]":"[cloud_password]" -X PUT -H "Content-Type: text/plain" --data-binary "data-id=[data-id]https://my.eu1.fredhopperservices.com/upload:[service_instance]/trigger/finalize`\
   `curl -D - -u "[cloud_username]":"[cloud_password]" -X PUT -H "Content-Type: text/plain" --data-binary "data-id=2020-02-21_15-31-55"https://my.eu1.fredhopperservices.com/upload:live1/trigger/finalize`

   **Example response:**

   `HTTP/1.1 200 OK`

   `Date: Fri, 21 Feb 2020 15:49:09 GMT`

   `Server: Jetty(9.4.22.v20191022)`

   `Content-Type: text/plain`

   `Content-Length: 57`

   `Connection: close`

   `RUNNING`

   `Started execution at Fri Feb 21 15:47:17 UTC 2020`

   `... and when successfully completed, the response should appear as follows:`

   `HTTP/1.1 200 OK`

   `Date: Fri, 21 Feb 2020 15:51:15 GMT`

   `Server: Jetty(9.4.22.v20191022)`

   `Content-Type: text/plain`

   `Content-Length: 8`

   `Connection: close`
6. Monitor the process by using the value of the 'Location' in the previous step and viewing the newly-created status file until the content is either SUCCESS or FAILURE.\
   **REST URL:**\
   <https://my.eu1.fredhopperservices.com/upload:\\[service\\_instance]/trigger/finalize/\\[trigger-id]/status\\>
   **cURL example:**\
   `curl -s -D - -u "[cloud_username]":"[cloud_password]" https://my.eu1.fredhopperservices.com/upload:[service_instance]/t`

   `rigger/finalize/[trigger-id]/status`<br>

   `curl -s -D - -u "[cloud_username]":"[cloud_password]" https://my.eu1.fredhopperservices.com/upload:live1/trigger/finalize`

   `/2020-02-21_15-47-17/status`\
   **Example response:**\
   `HTTP/1.1 200 OK`

   `Date: Fri, 21 Feb 2020 15:49:09 GMT`

   `Server: Jetty(9.4.22.v20191022)`

   `Content-Type: text/plain`

   `Content-Length: 57`

   `Connection: close`<br>

   `RUNNING`

   `Started execution at Fri Feb 21 15:47:17 UTC 2020`\
   **When successfully completed, the response should appear as follows:**\
   `HTTP/1.1 200 OK`

   `Date: Fri, 21 Feb 2020 15:51:15 GMT`

   `Server: Jetty(9.4.22.v20191022)`

   `Content-Type: text/plain`

   `Content-Length: 8`

   `Connection: close`

   `SUCCESS`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://crownpeak.gitbook.io/product-discovery/sending-and-managing-analytics-data/sending-analytics-data-using-other-providers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
