6. Example using cURL

Now that you've learned how to request content with the Displayable Content Export (DCE) you can try it out using cURL.

About cURL

cURL is a command line application for making API requests. It has the advantages of being supported on both Windows, Mac, and linux/unix and is highly configurable.

This tutorial will make use of the following curl options.

  • -i : Include headers with the output
  • -L : Follow redirects
  • -H : Set header
  • -O : Save response as file. Uses the name of the downloaded file and saves to folder where the command was run

Learn more about cURL here.

Steps

πŸ“˜

You should have read the walk-through before continuing.

1. Request manifest file list

In this step you will request a manifest file list, which is a list of available manifest files. Refer to step 1 of the walk-through for more information.

curl 'https://stg.api.bazaarvoice.com/dce/v3/data'   
  -H 'X-Bazaarvoice-Signature: SIGNATURE'   
  -H 'X-Bazaarvoice-Timestamp: TIMESTAMP'   
  -H 'X-Bazaarvoice-Passkey: PASSKEY'

2. Request manifest file location

In this step you will use a manifest file path, acquired from the manifest file list, to request the location of a manifest file. The response will be a 302 redirect. Refer to step 2 of the walk-through for more information.

Perform one of these cURL commands:

#Perform this request, then use the response in step 3 below.

curl -i 'https://stg.api.bazaarvoice.com/dce/v3/data?path=PATH_FROM_MANIFEST_FILE_LIST'  
-H 'X-Bazaarvoice-Signature: SIGNATURE'   
-H 'X-Bazaarvoice-Timestamp: TIMESTAMP'   
-H 'X-Bazaarvoice-Passkey: PASSKEY'
#This cURL command will also do step 3, following the 302 redirect, automatically. Perform this command, then skip to 4\. Request UGC Data File Location below.

curl -L 'https://stg.api.bazaarvoice.com/dce/v3/data?path=PATH_FROM_MANIFEST_FILE_LIST' \
  -H 'X-Bazaarvoice-Signature: SIGNATURE' \ 
  -H 'X-Bazaarvoice-Timestamp: TIMESTAMP' \  
  -H 'X-Bazaarvoice-Passkey: PASSKEY'

#This will show you what the redirect response looks like. The DCE consuming application you eventually build may follow the redirect automatically.

This will show you what the redirect response looks like. The DCE consuming application you eventually build may follow the redirect automatically.

3. Follow 302 redirect to manifest file

In this step you will follow the redirect URL from the previous step. Refer to step 3 of the walk-through for more information.

curl 'URL_FROM_STEP_2_RESPONSE'

4. Request UGC data file Location

In this step you will use a UGC data file path, acquired from the manifest file, to request the location of a UGC data file. The response will be a 302 redirect. Refer to step 4 of the walk-through for more information.

Perform one of these cURL commands:

#Perform this request, then use the response in step 5 below.

curl -i '<https://stg.api.bazaarvoice.com/dce/v3/data?path=PATH_FROM_MANIFEST_FILE'> \ 
  -H 'X-Bazaarvoice-Signature: SIGNATURE' \ 
  -H 'X-Bazaarvoice-Timestamp: TIMESTAMP' \ 
  -H 'X-Bazaarvoice-Passkey: PASSKEY'

#This will show you what the redirect response looks like. Your application may follow the redirect automatically.
#This cURL command will also do step 5, following the 302 redirect, automatically. Perform this command, then you're done. The file will be saved in the folder where you executed the cURL command.

curl -LO '<https://stg.api.bazaarvoice.com/dce/v3/data?path=PATH_FROM_MANIFEST_FILE'> \ 
  -H 'X-Bazaarvoice-Signature: SIGNATURE' \
  -H 'X-Bazaarvoice-Timestamp: TIMESTAMP' \
  -H 'X-Bazaarvoice-Passkey: PASSKEY'

This will show you what the redirect response looks like. Your application may follow the redirect automatically.

5. Follow 302 redirect to UGC data file

Finally, you will follow the redirect URL from the previous step. Refer to step 5 of the walk-through for more information.

Perform this command, then you're done. The UGC file will be saved in the folder where you executed the cURL command.

curl -O 'URL_FROM_STEP_4_RESPONSE'

Next steps

Head over to the Reference section to quickly look up technical details as you build your DCE integration.