Create an option list

post

/api/REST/1.0/assets/optionList

Creates an option list that matches the criteria specified by the request body.

Request

Supported Media Types
Body ()
The request body defines the details of the option list to be created.
Root Schema : OptionList
Type: object
Title: OptionList
Show Source
Nested Schema : elements
Type: array
A list of option elements.
Show Source
Nested Schema : Option
Type: object
Title: Option
Show Source
Back to Top

Response

Supported Media Types

201 Response

Success.
Body ()
Root Schema : OptionList
Type: object
Title: OptionList
Show Source
Nested Schema : elements
Type: array
A list of option elements.
Show Source
Nested Schema : Option
Type: object
Title: Option
Show Source

400 Response

Bad request. See Status Codes for information about other possible HTTP status codes.

401 Response

Unauthorized. See Status Codes for information about other possible HTTP status codes.

403 Response

Forbidden. See Status Codes for information about other possible HTTP status codes.

404 Response

The requested resource was not found. See Status Codes for information about other possible HTTP status codes.

500 Response

The service has encountered an error. See Status Codes for information about other possible HTTP status codes.
Back to Top

Examples

The following examples demonstrate how to create a new option list using an HTTP request and cURL. For more information on requests, see API requests.

HTTP Request Example

Create a new option list:


POST /api/REST/1.0/assets/optionList
Content-Type: application/json
			

Request body:


{
    "name":"Favorite Candy",
    "elements":[
        {
            "type":"Option",
            "displayName":"-- Please Select --",
            "value":"no selection"
        },
        {
            "type":"Option",
            "displayName":"Chocolate",
            "value":"chocolate"
        },
        {
            "type":"Option",
            "displayName":"Licorice",
            "value":"licorice"
        },
        {
            "type":"Option",
            "displayName":"Gumdrops",
            "value":"gumdrops"
        },
        {
            "type":"Option",
            "displayName":"Peppermint",
            "value":"peppermint"
        },
        {
            "type":"Option",
            "displayName":"Caramel",
            "value":"caramel"
        }
    ]
}
			

Note:

The options in an option list are displayed in the order they appear in the "elements" array. It's good practice to have a default selection such as above ("-- Please Select --") so you don't artificially skew your results.

Response:


{
    "type":"OptionList",
    "id":"23",
    "createdAt":"1435677162",
    "createdBy":"19",
    "depth":"complete",
    "name":"Favorite Candy",
    "updatedAt":"1435677162",
    "updatedBy":"19",
    "elements":[
        {
            "type":"Option",
            "displayName":"-- Please Select --",
            "value":"no selection"
        },
        {
            "type":"Option",
            "displayName":"Chocolate",
            "value":"chocolate"
        },
        {
            "type":"Option",
            "displayName":"Licorice",
            "value":"licorice"
        },
        {
            "type":"Option",
            "displayName":"Gumdrops",
            "value":"gumdrops"
        },
        {
            "type":"Option",
            "displayName":"Peppermint",
            "value":"peppermint"
        },
        {
            "type":"Option",
            "displayName":"Caramel",
            "value":"caramel"
        }
    ]
}
			

cURL Example

Here is the same example in cURL given an instance with the name APITest, username API.User, and POD of 3.


curl --user "APITest\API.User" --header "Content-Type: application/json" --request POST --data '{"name":"Favorite Candy","elements":[{"type":"Option","displayName":"-- Please Select --","value":"no selection"},{"type":"Option","displayName":"Chocolate","value":"chocolate"},{"type":"Option","displayName":"Licorice","value":"licorice"},{"type":"Option","displayName":"Gumdrops","value":"gumdrops"},{"type":"Option","displayName":"Peppermint","value":"peppermint"},{"type":"Option","displayName":"Caramel","value":"caramel"}]}' https://secure.p03.eloqua.com/api/REST/1.0/assets/optionList
			
Back to Top