Video Upload

This tutorial covers how to perform video uploads using the Bazaarvoice Conversations API. Readers will learn about the video upload process and walk-through the steps involved in performing a video upload.

Overview

Video upload permits users to upload their own videos as part of submitting content allowing them to better express their experiences and assist other customers by showing them products in real-life scenarios.

Videos uploaded to the Bazaarvoice platform must be associated with a piece of primary content. This is accomplished through a two-step process:

  1. Video is uploaded to Bazaarvoice platform using an HTTP POST request to the API endpoint described at Video Upload documentation. Upon successful video upload, you will receive a Cloudfront URL.
  • EX: POST https://[stg]media.api.bazaarvoice.com/data/uploadvideo.json
  1. Associate successfully uploaded video with one of the following primary content types during the submission process:
  • Review

This two step process makes it possible to show users the results of a video upload before they complete the primary content submission. For example, a reviewer might upload videos while writing a review (step 1), and then see those videos in the context of the form before completing the review submission (step 2).

Submission guidelines

Video submission is subjected to the following:

  • Size: Must not exceed 200 MB
  • Supported File Formats: GP/3G2, ASF, AVI, DV, FLV, MOV, MP4/F4V, MPEG/MPG, QT, or WMV
  • Only supported for reviews
  • Only 1 video per review is allowed
  • Your configuration must allow video upload as well. This can be enabled on Configuration Hub.

Walk-through

Step 1: Upload video to Bazaarvoice

Videos can be uploaded using the video file directly.

Video file

Switch to the directory of video file, and execute the following cURL command.

curl -F video=@your_video.mpeg -F apiversion=5.4 -F contenttype=Review -F passkey=your_API_Key    
https://[stg]media.api.bazaarvoice.com/data/uploadvideo.json

Response

This truncated response to a successful upload shows the Cloudfront URL.

{  
    "Video": {  
        "VideoId": "861f7833-1ef4-43a9-a214-43b8d06381ab",  
        "VideoHost": "BAZAARVOICE",  
        "VideoThumbnailUrl": "https://d2pg9tvqg9rw5b.cloudfront.net/861f7833-1ef4-43a9-a214-43b8d06381ab/thumbnail/image-00001.png",  
        "VideoUrl": "https://d2pg9tvqg9rw5b.cloudfront.net/861f7833-1ef4-43a9-a214-43b8d06381ab/video/movie.mp4"
    },  
    ...  
    "HasErrors": false  
}

Step 2: Associate video with primary content

Once a video has been uploaded it can be associated with a piece of primary content. This is accomplished by submitting the Cloudfront URL, provided in the response to a successful video upload, with the primary content.

Video can be linked with the review using both Full Submission and Progressive Submission.

Full Submission

To execute the following cURL command it may be necessary to modify the UserId or UserNickname parameters.

curl https://[stg].api.bazaarvoice.com/data/submitreview.json?passkey=your_API_Key  
-d apiversion=5.4  
-d productId=product1  
-d rating=5  
-d reviewtext=Testing video submission review
-d title=Testing video submission  
-d action=submit  
-d usernickname=test1  
-d agreedtotermsandconditions=yes  
-d sendemailalertwhenpublished=true  
-d user=015b29e3c80faf74172228eee0a7756f646174653d3230323231303130267573657269643d726d6f68616e26656d61696c616464726573733d726d6f68616e25343062762e636f6d26757365726e616d653d726d6f68616e266d61786167653d333635267375626a6563746964733d70726f6475637431  
-d videourl_1=https://d2pg9tvqg9rw5b.cloudfront.net/6c7855ce-534e-4ec2-8418-a6a7eda99e51/video/movie.mp4
-d videocaption_1=testing site auth video caption

Note: The above cURL command uses the videocaption_1 parameter to associate a caption with videourl_1

Progressive Submission

Progressive Submission is comprised of the following two endpoints: initiateSubmit and progressiveSubmit

  1. initiateSubmit

The initiateSubmit endpoint is used to request product info for building review submission form(s). This action must be done with an HTTP POST. More details on initiateSubmit here.

POST /data/initiateSubmit.{FORMAT}?passkey={CONVERSATIONS_API_PASSKEY}&apiVersion={latestApiVersion} HTTP/1.1
Host: [stg.]api.bazaarvoice.com
Content-Type: application/json
X-Forwarded-For: [AuthorIPAddress]      
…

{
  "locale": "en_US",
  "userToken": "{SOME_USER_TOKEN}",
  "productIds": [
    "Product1",
    "ProductZ"
  ]
}

Ellipses (…) in above example indicate that your app may generate other headers.

Response format

{
    "hasErrors": false,
    "response": {
        "userNickname": "test123",
        "productFormData": {
            "product1": {
                "review": {
                    "submissionID": "r229778_17131768kMu31S9pzRvvvftv",
                    "productExternalID": "product1",
                    "submissionTime": "2024-04-15@10:26:40"
                },
                "fieldsOrder": [
                    "videourl_1",
                    "videocaption_1",
                ],
                "fields": {
                  ...
                  	"videourl_1": {
                        "id": "videourl_1",
                        "type": "url",
                        "class": "videourl"
                    },
                   "videocaption_1": {
                        "id": "videocaption_1",
                        "type": "text",
                        "class": "videocaption"
                    }
                	}
                },
                "submissionSessionToken": "RsVCLU9SzhI5TfRKQd1eJi7//ao5v2pV2+Ui/NlU1TM6nnoyrjI7WV4guUx0y3FNCuMuQBPgu2+BIhTI7/QR64D+24m54XmseLYINfW3duw="
            }
        }
    }
}
  1. progressiveSubmit
curl -L -X POST 'http://stg.api.bazaarvoice.com/data/progressiveSubmit.json?apiVersion=5.4&action=submit&passkey=your_API_Key' \
-H 'Content-Type: application/json' \
--data-raw '{
    "locale": "en_US",
    "productId": "product1",
    "useremail": "[email protected]",
    "userToken": "015b29e3c80faf74172228eee0a7756f646174653d3230323231303130267573657269643d726d6f68616e26656d61696c616464726573733d726d6f68616e25343062762e636f6d26757365726e616d653d726d6f68616e266d61786167653d333635267375626a6563746964733d70726f6475637431",
    "submissionSessionToken": "RsVCLU9SzhI5TfRKQd1eJi7//ao5v2pV2+Ui/NlU1TM6nnoyrjI7WV4guUx0y3FNCuMuQBPgu2+BIhTI7/QR64D+24m54XmseLYINfW3duw=",
    "submissionFields": {
        "rating": "4",
        "title": "Video Testing",
        "reviewtext": "Stg_videoSubmission testing for progressive endpoint for video upload_Testing",
        "agreedtotermsandconditions": "true",
        "usernickname": "test123",
        "videourl_1": "https://d2pg9tvqg9rw5b.cloudfront.net/5b141bd0-0617-4898-880f-56a985f935c9/video/movie.mp4",
        "videocaption_1": "testing site auth video caption"
    }
}'

Note: The above cURL command uses the videocaption_1 parameter to associate a caption with videourl_1

Response to Review after video upload

Requesting reviews using a filter and returning videos for a particular product

https://stg.api.bazaarvoice.com/data/reviews.json?apiversion=5.4&passkey=caB45h2jBqXFw1OE043qoMBD1gJC8EwFNCjktzgwncXY4&Filter=ProductId:data-gen-moppq9ekthfzbc6qff3bqokie&Filter=HasVideos:eq:true

Response format

{
  "Limit": 10,
  "Offset": 0,
  "TotalResults": 1,
  "Locale": "en_US",
  "Results": [
    {
      Id": "123456",
      "CID": "76769b053-972a-5d88-aa70-f492f905bbc9",
      "SourceClient": "test",
      ...
      "Videos": [
        {
          "VideoId": "6c7855ce-534e-4ec2-8418-a6a7eda99e51",
          "VideoHost": "BAZAARVOICE",
          "VideoThumbnailUrl": "https://d2pg9tvqg9rw5b.cloudfront.net/6c7855ce-534e-4ec2-8418-a6a7eda99e51/thumbnail/image-00001.png",
          "VideoIframeUrl": null,
          "Caption": "Testing video submission CH",
          "VideoUrl": "https://d2pg9tvqg9rw5b.cloudfront.net/6c7855ce-534e-4ec2-8418-a6a7eda99e51/video/movie.mp4"
        }
      ],
      ...
    }
  ],
  "Includes": { },
  "HasErrors": false,
  "Errors": [ ]
}