Photo Upload

Upload photos for a review, question, or answer.

🚧

Only API keys on our Conversations platform are eligible to use this API version. Refer to the Platforms section of our Platform & API Concepts documentation to learn which platform your API keys are on.

📘

Try out Photo Upload API reference here.

Examples

The following examples demonstrate common photo upload requests. For a complete overview of photo uploads, refer to the Photo Upload tutorial.

Upload a photo from a file

Photos must be uploaded using HTTP POST.

POST /data/uploadphoto.json?ApiVersion=[latestApiVersion]&ContentType=[review|question|answer]&PassKey=[yourKey] HTTP/1.1
Host: stg.api.bazaarvoice.com
Content-Length: 71374
Content-Type: multipart/form-data; boundary=----FormBoundarycSTk3Rd73AEuhGuD
...

----FormBoundaryE19zNvXGzXaLvS5C
Content-Disposition: form-data; name="photo"; filename="your_image.jpg"
Content-Type: image/jpeg


---FormBoundaryE19zNvXGzXaLvS5C

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

Upload a photo from a URL

Photo upload URLs must be submitted using HTTP POST.

POST /data/uploadphoto.[FORMAT] HTTP/1.1
Host: [stg.]api.bazaarvoice.com
Content-Type: application/x-www-form-urlencoded
...

ApiVersion=[latestApiVersion]&ContentType=[review|question|answer]&PassKey=[yourKey]&photoUrl=[URLofPhoto]

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

Parameters

NameDescription
[FORMAT]Response format (json).

📝
Required
This field is required in all API requests.
ApiVersionThe API version, e.g. 5.4.

📝
Required
This field is required in all API requests.
ContentTypeThe content type for which this media is being submitted. Valid values include: review, question or answer.

📝
Required
This field is required in all API requests.
LocaleLocale to display Labels, Configuration, Product Attributes and Category Attributes in. The default value is the locale defined in the display associated with the API key.

🔺
Alert
Failure to submit this field will result in your content being ineligible for syndication, authenticity or other business processes.
PassKeyAPI key is required to authenticate API user and check permission to access particular client's data.

📝
Required
This field is required in all API requests.
PhotoA file representing the photo to be submitted. Note that the parameter name is case-sensitive and must be lowercase. Use either the photo or photoUrl parameter to define the photo to upload. An error is returned if both parameters are defined.

⚠️
Caution
This field may be required depending on per client configuration.
PhotoUrlURL of the photo to be uploaded. Use either the photo or photoUrl parameter to define the photo to upload. An error is returned if both parameters are defined. HTTP and HTTPS are the only protocols supported for the photoUrl parameter.

⚠️
Caution
This field may be required depending on per client configuration.
UserValue of the encrypted user. This parameter demonstrates that a user has been authenticated. Note that the UserId parameter does not contain authentication information and should not be used for hosted authentication. See the Authenticate User method for more information.

⚠️
Caution
This field may be required depending on per client configuration.
UserIdUser's external ID. This value should come from your authentication system. See Client-Mastered Authentication for more information.

🔺
Alert
Do not use an email address for this value.
⚠️
Caution
This field may be required depending on per client configuration.

Response format

The following is an example of a photo upload response:

{
  "HasErrors": false,
  "Data": {},
  "Form": [],
  "AuthorSubmissionToken": null,
  "FormErrors": {},
  "TypicalHoursToPost": null,
  "SubmissionId": null,
  "Locale": "en_US",
  "Errors": [],
  "Photo": {
    "Caption": null,
    "Sizes": {
      "thumbnail": {
        "Url": "https://apitestcustomer.ugc.bazaarvoice.com/bvstaging/5555/ps_amazon_s3_ea85cew8pya54lma81quray0k/photoThumb.jpg",
        "Id": "thumbnail"
      },
      "normal": {
        "Url": "https://apitestcustomer.ugc.bazaarvoice.com/bvstaging/5555/ps_amazon_s3_ea85cew8pya54lma81quray0k/photo.jpg",
        "Id": "normal"
      }
    },
    "SizesOrder": [
      "thumbnail",
      "normal"
    ],
    "Id": "ea85cew8pya54lma81quray0k"
  }
}

Error codes

Value Description
ERROR_ACCESS_DENIED

Insufficient privileges to perform the operation

ERROR_FORM_DUPLICATE

The nickname is already in use.

ERROR_FORM_DUPLICATE_NICKNAME

The nickname is already in use.

ERROR_FORM_IMAGE_HEIGHT_TOO_SMALL

Image must be a minimum number of pixels tall. The value is configurable by content type and/or by display code.

 

ERROR_FORM_IMAGE_PARSE

The uploaded image could not be parsed. Ensure the image is a valid PNG, GIF, JPEG, HEIC, or TIFF file.

 

ERROR_FORM_IMAGE_TOO_LARGE

The image could not be uploaded due to its size. Images must be less than 10 MB.

 

ERROR_FORM_IMAGE_WIDTH_TOO_SMALL

Image width must be a minimum number of pixels wide. The value is configurable by content type and/or by display code.

ERROR_FORM_INVALID_EMAILADDRESS

Email address is not in the proper format.

ERROR_FORM_INVALID_IPADDRESS

The IP address is invalid.

ERROR_FORM_INVALID_OPTION

The selected option has been removed.

ERROR_FORM_PATTERN_MISMATCH

This field is not in the correct format.

ERROR_FORM_PROFANITY

The content contains inappropriate language.

ERROR_FORM_REJECTED

The submission was rejected.

ERROR_FORM_REQUIRED

A required field was not supplied.

ERROR_FORM_REQUIRED_EITHER

Both of the required hosted authentication parameters are missing.

ERROR_FORM_REQUIRED_NICKNAME

You must enter a nickname.

ERROR_FORM_REQUIRES_TRUE

A field requires a value of true. (e.g., "You must agree to the terms and conditions.")

ERROR_FORM_RESTRICTED

Content provider's age is too young. (e.g., "Content cannot be accepted from minors under age 13.")

ERROR_FORM_STORAGE_PROVIDER_FAILED

The uploaded file could not be stored. Try uploading again later.

ERROR_FORM_SUBMITTED_NICKNAME

This nickname has already been submitted.

ERROR_FORM_TOO_FEW

There must be a minimum number of items contributed for this field.

ERROR_FORM_TOO_HIGH

This field has too many items.

ERROR_FORM_TOO_LONG

The field has too many characters.

ERROR_FORM_TOO_LOW

This field has too few items.

ERROR_FORM_TOO_SHORT

The field doesn't have enough characters.

ERROR_FORM_UPLOAD_IO

The item could not be uploaded. Ensure that it is a valid file type.

ERROR_PARAM_INVALID_API_KEY

Invalid API Key value

ERROR_PARAM_INVALID_LOCALE

Invalid locale code

ERROR_PARAM_INVALID_PARAMETERS

Invalid parameter in content submission

ERROR_PARAM_MISSING_USER_ID

This client does not allow unauthenticated submissions. A valid UserId is required.

ERROR_REQUEST_LIMIT_REACHED

Rate limiting error, i.e. too many requests per time interval

ERROR_UNKNOWN

Unknown error (internal server error, for instance)

ERROR_UNSUPPORTED

For unsupported features, clients etc.