Skip to content

Option_List

Jacob McConnell edited this page Jun 10, 2014 · 2 revisions

You must specify your API username and password using the Twocheckout.apiusername & Twocheckout.apipassword class variables before calling a method in this class.

##Methods

###list

Use to retrieve a list of all active options or only those matching a variety of option attributes.

####Arguments

  • hash Parameters
  • Hash containing list_options parameters. Parameters -> API List Options

####Returns

Returns a OptionList object.

####Example Usage:

HashMap<String, String> params = new HashMap<String, String>();
params.put("pagesize", "3");

OptionList result = TwocheckoutOption.list(params);

####Example Response (toJson):

{
   "options" : [
      {
         "option_id" : "4774467875",
         "option_name" : "Example Option",
         "option_values" : [
            {
               "option_value_id" : "4774467878",
               "option_value_name" : "Test",
               "option_value_surcharge" : "1.00"
            }
         ]
      },
      {
         "option_id" : "4774418663",
         "option_name" : "Example Option",
         "option_values" : [
            {
               "option_value_id" : "4774418666",
               "option_value_name" : "Test",
               "option_value_surcharge" : "1.00"
            }
         ]
      },
      {
         "option_id" : "4774386668",
         "option_name" : "Example Option",
         "option_values" : [
            {
               "option_value_id" : "4774386671",
               "option_value_name" : "test1",
               "option_value_surcharge" : "0.01"
            },
            {
               "option_value_id" : "4774386791",
               "option_value_name" : "test2",
               "option_value_surcharge" : "0.02"
            }
         ]
      }
   ],
   "page_info" : {
      "cur_page" : "1",
      "first_entry" : 1,
      "first_page" : 1,
      "first_page_url" : "https://www.2checkout.com/api/products/list_options?cur_page=1",
      "last_entry" : "3",
      "last_page" : 1,
      "last_page_url" : "https://www.2checkout.com/api/products/list_options?cur_page=1",
      "next_page" : null,
      "pagesize" : "20",
      "previous_page" : null,
      "total_entries" : "3"
   },
   "response_code" : "OK",
   "response_message" : "Option information retrieved successfully."
}

Clone this wiki locally