The Conversations API lets you programmatically retrieve and submit Bazaarvoice Conversations data for use in your applications. To learn more, go to the Conversations API documentation home page.

Contents

(+ show- hide)

This tutorial describes the input types available for full submission in the Bazaarvoice Conversations API. Developers will learn how to use the Type property to determine what graphical user interface elements to use in their applications.

This topic applies to full submission only. Information for progressive submission is coming soon.

Overview

The Typeproperty indicates the form of data the Conversations API expects to receive for a particular input.

The following snippet demonstrates the Type property in an API submission response:

"isrecommended": {
    "Default": null,
    "MaxLength": null,
    "Value": "false",
    "Required": false,
    "Type": "BooleanInput",
    "Label": null,
    "Id": " isrecommended ",
    "MinLength": null,
    "Options": [ ]
},
The code snippets in this tutorial come from Conversations API submission requests and represent the information needed to create form inputs in your application. Learn more at the API submission request documentation.

Available types

These types identify the kind of data that should be submitted for a particular input:

BooleanInput

    "Type": "BooleanInput"

Boolean inputs accept either "true" or "false" responses. They are typically used for inputs that allow the content author to indicate agreement with a statement or select from a list of values where each statement or option is a different API field. This could mean selecting several predetermined pro or con values, agreeing to a terms and conditions, indicating a statement is relevant to them or answering a yes/no question.

The following code samples demonstrate BooleanInputs:

Boolean input using checkbox.

Response from Bazaarvoice API submission preview request:

"sendemailalertwhenpublished": {
    "Default": null,
    "MaxLength": null,
    "Value": "true",
    "Required": false,
    "Type": "BooleanInput",
    "Label": null,
    "Id": "sendemailalertwhenpublished",
    "MinLength": null,
    "Options": [ ]
},
"sendemailalertwhencommented": {
    "Default": null,
    "MaxLength": null,
    "Value": "",
    "Required": false,
    "Type": "BooleanInput",
    "Label": null,
    "Id": "sendemailalertwhencommented",
    "MinLength": null,
    "Options": [ ]
},

Example of a valid value in submission POST request:

&sendemailalertwhenpublished=true&sendemailalertwhencommented=false

FileInput

"Type": "FileInput"

The FileInput type indicates that a photo or video is expected.

File upload input

Response from Bazaarvoice to API submission preview request:

"photo": {
    "Default": null,
    "Required": null,
    "Value": null,
    "MaxLength": null,
    "Type": "FileInput",
    "Label": null,
    "Id": "photo",
    "MinLength": null,
    "Options": [ ]
}

Example of a valid value in submission POST request:

&photo={binary_data}

IntegerInput

"Type": "IntegerInput"

The IntegerInput type indicates that the value being submitted should be an integer.

Overall rating IntegerInput

Response from Bazaarvoice to API submission preview request:

"rating": {
    "Default": null,
    "Value": null,
    "MaxLength": null,
    "Required": true,
    "Type": "IntegerInput",
    "Label": null,
    "Id": "rating",
    "MinLength": null,
    "Options": [ ]
},

Example of a valid value in submission POST request:

&rating=4

SelectInput

"Type": "SelectInput"

SelectInput inputs are questions for which the available options have been predetermined. Inputs associated with this type typically present the content author with a:

  • single select multiple choice style list of options
  • range of values from which the user may make on selection

List of options

SelectInput dropdown

Response from Bazaarvoice to API submission preview request:

contextdatavalue_Gender": {
    "Default": null,
    "Value": null,
    "MaxLength": null,
    "Required": false,
    "Type": "SelectInput",
    "Label": "What is your gender?",
    "Id": "contextdatavalue_Gender",
    "MinLength": null,
    "Options": [
        {
            "Value": "",
            "Selected": true,
            "Label": ""
        },
        {
            "Value": "Male",
            "Selected": false,
            "Label": "Male"
        },
        {
            "Value": "Female",
            "Selected": false,
            "Label": "Female"
        }
    ]
},

Example of a valid value in submission POST request:

&contextdatavalue_Gender=Female

Range of values

Rating dimension SelectInput

Response from Bazaarvoice to API submission preview request:

rating_Sliders": {
    "Default": null,
    "Value": null,
    "MaxLength": null,
    "Required": false,
    "Type": "SelectInput",
    "Label": "sliders",
    "Id": "rating_Sliders",
    "MinLength": null,
    "Options": [
        {
            "Value": "1",
            "Selected": false,
            "Label": "too small"
        },
        {
            "Value": "2",
            "Selected": false,
            "Label": "a little small"
        },
        {
            "Value": "3",
            "Selected": false,
            "Label": "as expected"
        },
        {
            "Value": "4",
            "Selected": false,
            "Label": "a little large"
        },
        {
            "Value": "5",
            "Selected": false,
            "Label": "too large"
        }
    ]
},

Example of a valid value in submission POST request:

&rating_Sliders=3

TextAreaInput

"Type": "TextAreaInput"

A TextAreaInput is used for longer answers that can include line breaks or paragraphs.

TextAreaInput

Response from Bazaarvoice to API submission preview request:

"reviewtext": {
    "Default": null,
    "Value": null,
    "MaxLength": 10000,
    "Required": false,
    "Type": "TextAreaInput",
    "Label": null,
    "Id": "reviewtext",
    "Options": [ ],
    "MinLength": 50
},

Example of a valid value in submission POST request:

&reviewtext=Proin%20quis%20erat%20facilisis%3B%20tempus%20eros%20in%2C%20tincidunt%20tellus.%0A%0ASed%20aliquam%20volutpat%20viverra.%20Nulla%20tellus%20magna%2C%20porta%20quis%20felis%20in%2C%20blandit%20hendrerit%20diam.

The example above is percent encoded. Note line breaks are represented by %0A%0A.

Bazaarvoice does not support marked-up user generated content. You should not allow, encourage or enable authors to submit content that includes HTML.

TextInput

"Type": "TextInput"

TextInput inputs accept a short answers with no line breaks, typically consisting a single word or short sentence/phrase.

TextInput

Response from Bazaarvoice to API submission preview request:

"title": {
    "Default": null,
    "Value": null,
    "MaxLength": 50,
    "Required": false,
    "Type": "TextInput",
    "Label": null,
    "Id": "title",
    "Options": [ ],
    "MinLength": 0
},

Example of a valid value in submission POST request:

&title=Proin%20quis%20erat%20facilisis%3B%20tempus%20eros%20in%2C%20tincidunt%20tellus.

The above example is percent encoded.

Bazaarvoice does not support marked-up user generated content. You should not allow, encourage or enable authors to submit content that includes HTML tags.